Replies: 1 comment
-
What's the error you are getting? I am not sure I get what you mean by object vs function. In your code, you're initializing |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Environment
System:
OS: macOS 15.2
CPU: (8) arm64 Apple M2
Memory: 167.84 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 23.5.0 - /usr/local/bin/node
npm: 11.0.0 - /opt/homebrew/bin/npm
pnpm: 9.15.2 - ~/Documents/GitHub/chatgpt-cooking/node_modules/.bin/pnpm
Watchman: 2024.09.02.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 131.0.6778.205
Safari: 18.2
npmPackages:
@auth/core: ^0.37.4 => 0.37.4
@auth/pg-adapter: ^1.7.4 => 1.7.4
@auth/prisma-adapter: ^2.7.4 => 2.7.4
next: 15.1.2 => 15.1.2
next-auth: 5.0.0-beta.25 => 5.0.0-beta.25
react: 19.0.0 => 19.0.0
Reproduction URL
https://github.com/jwwhangbo/NibbleAI/blob/PROTOTYPE/app/api/collections/route.ts
Describe the issue
When initializing NextAuth using a function that doesn't take any parameters,
it returns an auth function that doesn't work when used in middleware.ts or route.ts.
trying to fetch() from the route immediately returns a 500 internal error.
There were no issues when initializing NextAuth with an object instead of a function. Instead of creating a new PostgreSQL Pool instance within NextAuth (as shown in the database integration tutorial), an existing Pool object was imported and used.
How to reproduce
Instantiate NextAuth using a function that doesn’t take any parameters.
Expected behavior
auth() wrapper for route handlers and middleware should work normally.
Beta Was this translation helpful? Give feedback.
All reactions