Configure CredentialsProvider in the Nuxt config.
Set up a protected route that requires authentication.
Open a session as a guest user and try to access the protected page.
Expected Behavior: The guest user should be redirected to the login page without seeing any error.
Actual Behavior: An error occurs, disrupting the expected flow.
Context: Include the Nuxt version, the @sidebase/nuxt-auth version, and any relevant configuration or code snippets that might help in identifying the issue.
Describe the bug
When a guest (unauthenticated) user attempts to access a protected page configured with CredentialsProvider settings, an error is triggered. Expected behavior would be a redirect to the login page, but instead, an error page appears.
receive 500 status code
Additional context
No response
Logs
ERROR [nuxt] [request error] [unhandled] [500] The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of URLSearchParams
at __node_internal_captureLargerStackTrace (node:internal/errors:490:5)
at new NodeError (node:internal/errors:399:5)
at Function.from (node:buffer:324:9)
at ./node_modules/h3/dist/index.mjs:410:21
at async readBody (./node_modules/h3/dist/index.mjs:438:16)
at createRequestForAuthjs (./node_modules/@sidebase/nuxt-auth/dist/runtime/server/services/authjs/nuxtAuthHandler.js:123:70)
at Object.handler (./node_modules/@sidebase/nuxt-auth/dist/runtime/server/services/authjs/nuxtAuthHandler.js:42:25)
at async ./node_modules/h3/dist/index.mjs:1975:19
at async Object.callAsync (./node_modules/unctx/dist/index.mjs:72:16)
at async toNodeHandle (./node_modules/h3/dist/index.mjs:2266:7)
at async ufetch (./node_modules/unenv/runtime/fetch/index.mjs:9:17)
at async $fetchRaw2 (./node_modules/ofetch/dist/shared/ofetch.4747642d.mjs:249:26)
at async $fetch2 (./node_modules/ofetch/dist/shared/ofetch.4747642d.mjs:304:15)
at async Object.callAsync (./node_modules/unctx/dist/index.mjs:72:16)
at async signIn (./node_modules/@sidebase/nuxt-auth/dist/runtime/composables/authjs/useAuth.js:92:16)
at async Object.callAsync (./node_modules/unctx/dist/index.mjs:72:16)
at async ./node_modules/nuxt/dist/pages/runtime/plugins/router.js:189:26
Environment
Build Modules: -
Reproduction
Steps to Reproduce:
Configure CredentialsProvider in the Nuxt config. Set up a protected route that requires authentication. Open a session as a guest user and try to access the protected page. Expected Behavior: The guest user should be redirected to the login page without seeing any error.
Actual Behavior: An error occurs, disrupting the expected flow.
Context: Include the Nuxt version, the @sidebase/nuxt-auth version, and any relevant configuration or code snippets that might help in identifying the issue.
Describe the bug
When a guest (unauthenticated) user attempts to access a protected page configured with CredentialsProvider settings, an error is triggered. Expected behavior would be a redirect to the login page, but instead, an error page appears.
receive 500 status code
Additional context
No response
Logs
ERROR [nuxt] [request error] [unhandled] [500] The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of URLSearchParams at __node_internal_captureLargerStackTrace (node:internal/errors:490:5)
at new NodeError (node:internal/errors:399:5)
at Function.from (node:buffer:324:9)
at ./node_modules/h3/dist/index.mjs:410:21
at async readBody (./node_modules/h3/dist/index.mjs:438:16)
at createRequestForAuthjs (./node_modules/@sidebase/nuxt-auth/dist/runtime/server/services/authjs/nuxtAuthHandler.js:123:70)
at Object.handler (./node_modules/@sidebase/nuxt-auth/dist/runtime/server/services/authjs/nuxtAuthHandler.js:42:25)
at async ./node_modules/h3/dist/index.mjs:1975:19
at async Object.callAsync (./node_modules/unctx/dist/index.mjs:72:16)
at async toNodeHandle (./node_modules/h3/dist/index.mjs:2266:7)
at async ufetch (./node_modules/unenv/runtime/fetch/index.mjs:9:17)
at async $fetchRaw2 (./node_modules/ofetch/dist/shared/ofetch.4747642d.mjs:249:26)
at async $fetch2 (./node_modules/ofetch/dist/shared/ofetch.4747642d.mjs:304:15)
at async Object.callAsync (./node_modules/unctx/dist/index.mjs:72:16)
at async signIn (./node_modules/@sidebase/nuxt-auth/dist/runtime/composables/authjs/useAuth.js:92:16)
at async Object.callAsync (./node_modules/unctx/dist/index.mjs:72:16)
at async ./node_modules/nuxt/dist/pages/runtime/plugins/router.js:189:26
No response