next-auth: defaultCookies is not defined
Question 💬
Hi I’m using next-auth version: 3.27.3 I suddenly got this error while running my app. Anyone encountered this? Thank you.
error - unhandledRejection: ReferenceError: defaultCookies is not defined
at C:\Users\MAGICSOFT Mike\Desktop\NEW MAGICSOFT\crd-prototype\node_modules\next-auth\dist\server\index.js:102:9
at new Promise (<anonymous>)
at NextAuthHandler (C:\Users\MAGICSOFT Mike\Desktop\NEW MAGICSOFT\crd-prototype\node_modules\next-auth\dist\server\index.js:67:10)
at NextAuth (C:\Users\MAGICSOFT Mike\Desktop\NEW MAGICSOFT\crd-prototype\node_modules\next-auth\dist\server\index.js:299:10)
at __WEBPACK_DEFAULT_EXPORT__ (C:\Users\MAGICSOFT Mike\Desktop\NEW MAGICSOFT\crd-prototype\.next\server\pages\api\auth\[...nextauth].js:188:128)
at Object.apiResolver (C:\Users\MAGICSOFT Mike\Desktop\NEW MAGICSOFT\crd-prototype\node_modules\next\dist\server\api-utils.js:101:15)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async DevServer.handleApiRequest (C:\Users\MAGICSOFT Mike\Desktop\NEW MAGICSOFT\crd-prototype\node_modules\next\dist\server\next-server.js:775:9)
at async Object.fn (C:\Users\MAGICSOFT Mike\Desktop\NEW MAGICSOFT\crd-prototype\node_modules\next\dist\server\next-server.js:666:37)
How to reproduce ☕️
npm run dev
Contributing 🙌🏽
No, I am afraid I cannot help regarding this
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 16 (3 by maintainers)
Hi, v3 is an unmaintained version. Please upgrade to v4 and report back if you still experience the issue.
Same error here, nothing changed on the codebase (and using older v3), my client just did another deploy due to CMS updates. This is unacceptable.
EDIT I downgraded
next-authexplicitly to version3.29.3(was^3.29.3before) and now it works!I’ll have a look, thanks… Note that v3 has been unmaintained for a while now, even the security advisory points out that you should upgrade to v4, at some point (probably soon) we will stop patching v3.
If the issue happens in v4, that will be priority. cc @ThangHuuVu
3.29.6should include this fix: https://github.com/nextauthjs/next-auth/pull/4711, still unable to reproduce anything similar in v4.@balazsorban44 This is still broken and now the patch version for CVE-2022-31093 also includes this error. There is currently no way for anyone on v3 to avoid this vulnerability. This commenter has pinpointed the error so I think this should be addressed: https://github.com/nextauthjs/next-auth/commit/87f6f576b1f31249868991a2d1fecc4a9e4f5ce8#r75837858
I’ve just got the same problem, can’t upgrade because I’m using the firebase adapter. Downgrading to
3.29.3works. Thanks, fabien!Upgrading from 3.27.3 to 3.29.3 works for me too . Thanks!
I also get an error like that, even though previously the application was running fine.