"Cannot call server function outside of a request" in onRequest middlware hook

This doesn't happen all the time. But happens.
2 Replies
Sudhagar
SudhagarOP9mo ago
sso login failed Error: Cannot call server function outside of a request
at Object.apply (file:///var/task/chunks/runtime.mjs:6123:13)
at Ue.onRequest (file:///var/task/chunks/runtime.mjs:6777:23)
at file:///var/task/chunks/runtime.mjs:6560:34
at _callHandler (file:///var/task/chunks/runtime.mjs:2921:13)
at Object._handler [as handler] (file:///var/task/chunks/runtime.mjs:2908:12)
at file:///var/task/chunks/runtime.mjs:3047:31
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.callAsync (file:///var/task/chunks/runtime.mjs:5341:16)
at async toNodeHandle (file:///var/task/chunks/runtime.mjs:3313:7)
at async Server.<anonymous> (/opt/node-bridge/bridge-server-CNJTFAIF.js:1:9585)
sso login failed Error: Cannot call server function outside of a request
at Object.apply (file:///var/task/chunks/runtime.mjs:6123:13)
at Ue.onRequest (file:///var/task/chunks/runtime.mjs:6777:23)
at file:///var/task/chunks/runtime.mjs:6560:34
at _callHandler (file:///var/task/chunks/runtime.mjs:2921:13)
at Object._handler [as handler] (file:///var/task/chunks/runtime.mjs:2908:12)
at file:///var/task/chunks/runtime.mjs:3047:31
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.callAsync (file:///var/task/chunks/runtime.mjs:5341:16)
at async toNodeHandle (file:///var/task/chunks/runtime.mjs:3313:7)
at async Server.<anonymous> (/opt/node-bridge/bridge-server-CNJTFAIF.js:1:9585)
The first ever trigger of the route, I see this. Doesn't happen on subsequent triggers
sabercoy
sabercoy6mo ago
I just got this, found out it was from calling a server function (a function marked with 'use server') inside of middleware I guess you cannot call server functions in middleware this looks like it is your case seeing that an error occured in "onRequest"
Want results from more Discord servers?
Add your server