I tried to get an answer to this issue for weeks already and didn't manage to get any help.
After I upgraded to NextJS 13.5/14 from 13.4 I started to get this error each time I'm trying to login. I'm using next-auth with TypeORM-Adapter connected to PostgreSQL. The strange thing about it, is that I only get this error in production mode and not in development mode.
[next-auth][error][adapter_error_getSessionAndUser]
https://next-auth.js.org/errors#adapter_error_getsessionanduser No metadata for "SessionEntity" was found. {
message: 'No metadata for "SessionEntity" was found.',
stack: 'EntityMetadataNotFoundError: No metadata for "SessionEntity" was found.\n' +
' at t.DataSource.getMetadata (/home/guy/workspace/falkordb-cloud/.next/server/chunks/871.js:52:45111)\n' +
' at t.EntityManager.findOne (/home/guy/workspace/falkordb-cloud/.next/server/chunks/871.js:149:25750)\n' +
' at getSessionAndUser (/home/guy/workspace/falkordb-cloud/.next/server/chunks/871.js:150:415819)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)',
name: 'EntityMetadataNotFoundError'
}
I tried to play with the code, but I couldn't find a solution it seems like something has changed in the way nextjs is building the code in 13.5/14
Published on stackoverflow
https://stackoverflow.com/questions/77348457/error-https-next-auth-js-org-errorsadapter-error-getsessionanduser-no-metada
On next-auth repo
https://github.com/nextauthjs/next-auth/issues/8822
After I upgraded to NextJS 13.5 from 13.4 I started to get this error each time I'm trying to login. I'm using next-auth with TypeORM-Adapter connected to PostgreSQL.
The strange thing about it, is...