You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When successfully getting a token from the SurrealDB server (I got a result via DevTools), this token is not used by the subsequent SELECT exp FROM $session that is queried during getSessionExp. No Authorization HTTP request header is present for that RPC call.
I tried using DevTools Debugger to figure out where this is going wrong. It seems like the correct values (the Authorization header with the Bearer token) are being passed to the surrealFetch (within the surrealRPC function), but the onRequest handler seems to remove it.
The result of surrealFetchOptionsOverride(database, options) does not contain the Authorization header any more. Ths is OK, because there is no auth preset defined.
When it then comes to the defu call, it cannot correctly handle options.headers being a fancy Headers object, where it cannot simply 'set' the header values. Thus, after the defu call, we're left with whatever was in headers (and not options.headers) - which is just the presets and not the options.headers (with token) that were passed along.
This is my code:
When successfully getting a token from the SurrealDB server (I got a
result
via DevTools), this token is not used by the subsequentSELECT exp FROM $session
that is queried duringgetSessionExp
. NoAuthorization
HTTP request header is present for that RPC call.I tried using DevTools Debugger to figure out where this is going wrong. It seems like the correct values (the Authorization header with the Bearer token) are being passed to the
surrealFetch
(within thesurrealRPC
function), but theonRequest
handler seems to remove it.nuxt-surrealdb/src/runtime/plugin.ts
Lines 20 to 32 in 2191857
The result of
surrealFetchOptionsOverride(database, options)
does not contain theAuthorization
header any more. Ths is OK, because there is noauth
preset defined.When it then comes to the
defu
call, it cannot correctly handleoptions.headers
being a fancyHeaders
object, where it cannot simply 'set' the header values. Thus, after thedefu
call, we're left with whatever was inheaders
(and notoptions.headers
) - which is just the presets and not the options.headers (with token) that were passed along.Potentially related: https://github.com/unjs/ofetch/releases/tag/v1.4.0
The text was updated successfully, but these errors were encountered: