mickasmt / next-saas-stripe-starter

Open-source SaaS Starter with User Roles & Admin Panel. Built using Next.js 14, Prisma, Neon, Auth.js v5, Resend, React Email, Shadcn/ui, Stripe, Server Actions.
https://next-saas-stripe-starter.vercel.app
MIT License
1.95k stars 357 forks source link

Not working with postgres and npm - UnknownAction: Cannot parse action at /session .Read more at https://errors.authjs.dev#unknownaction #11

Closed huksley closed 8 months ago

huksley commented 8 months ago

So I am trying a fairly standard setup, except I use supabase (postgress) + npm instead of pnpm.

Error is following:

 ✓ Compiled /api/auth/[...nextauth] in 554ms (264 modules)
[auth][warn][debug-enabled] Read more: https://warnings.authjs.dev#debug-enabled
 ✓ Compiled /middleware in 151ms (264 modules)
[auth][error] UnknownAction: Cannot parse action at /session .Read more at https://errors.authjs.dev#unknownaction
    at parseActionAndProviderId (webpack-internal:///(middleware)/./node_modules/next-auth/node_modules/@auth/core/lib/utils/web.js:87:27)
    at toInternalRequest (webpack-internal:///(middleware)/./node_modules/next-auth/node_modules/@auth/core/lib/utils/web.js:32:40)
    at Auth (webpack-internal:///(middleware)/./node_modules/next-auth/node_modules/@auth/core/index.js:82:103)
    at getSession (webpack-internal:///(middleware)/./node_modules/next-auth/lib/index.js:22:60)
    at handleAuth (webpack-internal:///(middleware)/./node_modules/next-auth/lib/index.js:134:35)
    at Object.request (webpack-internal:///(middleware)/./node_modules/next-auth/lib/index.js:116:24)
    at eval (webpack-internal:///(middleware)/./node_modules/next/dist/esm/server/web/adapter.js:193:27)
    at AsyncLocalStorage.run (node:async_hooks:346:14)
    at Object.wrap (webpack-internal:///(middleware)/./node_modules/next/dist/esm/server/async-storage/request-async-storage-wrapper.js:81:24)
    at eval (webpack-internal:///(middleware)/./node_modules/next/dist/esm/server/web/adapter.js:180:122)
(node:56485) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

I switched to use Next-Auth 4.x and it works fine now.

mickasmt commented 8 months ago

I can't really tell you what the problem is in your code. The best would be to have a codepen which could reproduce this error but authjs v5 is still in beta and I haven't used Supabase with this project yet. If you resolve the issue, please feel free to post a link to the solution.