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
I'm just posting this so if someone having the same issues I was finds it they will see this in search results hopefully, lost a day to trying to figure this out.
If you are using MongoDB Adapter and your auth is working but randomly loses connection to a 500/502 error and kicks the user back to the login page, but the session still exists in /api/auth/session
For example getting the error codes:
error decoding lambda response: error decoding lambda response: unexpected end of JSON input
[next-auth][error][CLIENT_FETCH_ERROR] https://next-auth.js.org/errors#client_fetch_error JSON.parse: unexpected character at line 1 column 1 of the JSON data
or in vercel logs
MongoServerSelectionError: Server selection timed out after 30000 ms at Timeout._onTimeout (/var/task/node_modules/mongodb/lib/sdam/topology.js:292:38) { reason: [TopologyDescription], code: undefined } Unhandled Rejection: MongoServerSelectionError: Server selection timed out after 30000 ms at Timeout._onTimeout (/var/task/node_modules/mongodb/lib/sdam/topology.js:292:38) { reason: [TopologyDescription], code: undefined } Node.js process exited with exit status: 128.
with correct .env variables and configurations, and properly allowing ips in mongoDB still getting these errors,
You are likely using an outdated mongodb.ts file from older documentation that sends clientPromise instead of a connected client and due to some weird issues with stale requests and caching it will occasionally send 500 erors
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm just posting this so if someone having the same issues I was finds it they will see this in search results hopefully, lost a day to trying to figure this out.
If you are using MongoDB Adapter and your auth is working but randomly loses connection to a 500/502 error and kicks the user back to the login page, but the session still exists in /api/auth/session
For example getting the error codes:
error decoding lambda response: error decoding lambda response: unexpected end of JSON input
[next-auth][error][CLIENT_FETCH_ERROR] https://next-auth.js.org/errors#client_fetch_error JSON.parse: unexpected character at line 1 column 1 of the JSON data
or in vercel logs
MongoServerSelectionError: Server selection timed out after 30000 ms at Timeout._onTimeout (/var/task/node_modules/mongodb/lib/sdam/topology.js:292:38) { reason: [TopologyDescription], code: undefined } Unhandled Rejection: MongoServerSelectionError: Server selection timed out after 30000 ms at Timeout._onTimeout (/var/task/node_modules/mongodb/lib/sdam/topology.js:292:38) { reason: [TopologyDescription], code: undefined } Node.js process exited with exit status: 128.
with correct .env variables and configurations, and properly allowing ips in mongoDB still getting these errors,
You are likely using an outdated mongodb.ts file from older documentation that sends clientPromise instead of a connected client and due to some weird issues with stale requests and caching it will occasionally send 500 erors
Refer to:
https://authjs.dev/getting-started/adapters/mongodb
vercel/vercel#11178
mongodb-developer/nextjs-with-mongodb#1
Beta Was this translation helpful? Give feedback.
All reactions