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
adaptersChanges related to the core code concerning database adaptersbugSomething isn't workingtriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
importNextAuthfrom'next-auth';importSendGridfrom'next-auth/providers/sendgrid';import{TypeORMAdapter}from'@auth/typeorm-adapter';exportconst{ handlers, signIn, signOut, auth }=NextAuth({providers: [SendGrid({from: '[email protected]',})],adapter: TypeORMAdapter({type: 'postgres',host: process.env.PG_MASTER_HOST!,port: parseInt(process.env.PG_MASTER_PORT!,10),username: process.env.PG_USER!,password: process.env.PG_PASSWORD!,database: process.env.PG_DB!,synchronize: true,}),callbacks: {authorized: async({ auth })=>{// Logged in users are authenticated, otherwise redirect to login pagereturn!!auth},signIn({ user }){return!!user.email?.endsWith('@refound.com');},},debug: true});
When signing in the magic link is sent to my email and a verification record is inserted into the db, however when I follow the link in the email I get the following error.
[auth][error] SessionTokenError: Read more at https://errors.authjs.dev#sessiontokenerror
[auth][cause]: TypeError: Cannot read properties of undefined (reading 'type')
at EntityManagerFactory.create (/home/ahi/WebstormProjects/satori_nextjs/apps/admin/.next/server/edge/chunks/1459c_typeorm_browser_86bd9157._.js:6898:39)
at DataSource.createEntityManager (/home/ahi/WebstormProjects/satori_nextjs/apps/admin/.next/server/edge/chunks/1459c_typeorm_browser_86bd9157._.js:9093:443)
at new DataSource (/home/ahi/WebstormProjects/satori_nextjs/apps/admin/.next/server/edge/chunks/1459c_typeorm_browser_86bd9157._.js:8802:29)
at getManager (/home/ahi/WebstormProjects/satori_nextjs/apps/admin/.next/server/edge/chunks/node_modules__pnpm_c519da07._.js:9962:23)
at getSessionAndUser (/home/ahi/WebstormProjects/satori_nextjs/apps/admin/.next/server/edge/chunks/node_modules__pnpm_c519da07._.js:10075:29)
at acc.<computed> (/home/ahi/WebstormProjects/satori_nextjs/apps/admin/.next/server/edge/chunks/c1962_@auth_core_a0c6e6aa._.js:1364:30)
at session (/home/ahi/WebstormProjects/satori_nextjs/apps/admin/.next/server/edge/chunks/c1962_@auth_core_a0c6e6aa._.js:4301:36)
at AuthInternal (/home/ahi/WebstormProjects/satori_nextjs/apps/admin/.next/server/edge/chunks/c1962_@auth_core_a0c6e6aa._.js:4838:269)
at async Auth (/home/ahi/WebstormProjects/satori_nextjs/apps/admin/.next/server/edge/chunks/c1962_@auth_core_a0c6e6aa._.js:5091:34)
at async handleAuth (/home/ahi/WebstormProjects/satori_nextjs/apps/admin/.next/server/edge/chunks/node_modules__pnpm_c519da07._.js:3918:29)
[auth][details]: {}
How to reproduce
Request a magic link then follow it from your email
Expected behavior
The db connection to work
The text was updated successfully, but these errors were encountered:
a-h-i
added
adapters
Changes related to the core code concerning database adapters
bug
Something isn't working
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
labels
Apr 7, 2025
a-h-i
changed the title
etting cannot read properties of undefined (reading 'type')
getting cannot read properties of undefined (reading 'type')
Apr 7, 2025
adaptersChanges related to the core code concerning database adaptersbugSomething isn't workingtriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Adapter type
@auth/typeorm-adapter
Environment
Reproduction URL
https://github.com/a-h-i/next-typeorm-minimalexample
Describe the issue
I have setup the next app auth.ts like so
When signing in the magic link is sent to my email and a verification record is inserted into the db, however when I follow the link in the email I get the following error.
How to reproduce
Request a magic link then follow it from your email
Expected behavior
The db connection to work
The text was updated successfully, but these errors were encountered: