-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Adapter type
@auth/dynamodb-adapter
Environment
System:
OS: Linux 6.8 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
CPU: (12) x64 AMD Ryzen 5 3600X 6-Core Processor
Memory: 13.21 GB / 31.26 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 22.15.1 - /usr/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 10.9.2 - /usr/bin/npm
pnpm: 9.12.3 - /usr/bin/pnpm
Browsers:
Chrome: 136.0.7103.113
Chromium: 136.0.7103.92
npmPackages:
@auth/dynamodb-adapter: ^2.9.1 => 2.9.1
next: 15.3.2 => 15.3.2
next-auth: ^5.0.0-beta.28 => 5.0.0-beta.28
react: ^19.0.0 => 19.1.0
Reproduction URL
https://github.com/hunternet93/authjs-dynamodb-provider-test
Describe the issue
When using the DynamoDB adapter in conjunction with the SendGrid provider, I'm getting unexpected behavior and errors when attempting to log in.
The SendGrid provider is able to store a User record in my DynamoDB and send the magic link email. The first time a magic link is opened for a particular email, it appears to work as expected. However, await auth() returns null instead of the session.
On subsequent attempts for the same email, opening a magic link results in the following exception being logged:
[auth][error] CallbackRouteError: Read more at https://errors.authjs.dev#callbackrouteerror
[auth][cause]: Error: Missing or invalid provider account
at handleLoginOrRegister (webpack-internal:///(rsc)/./node_modules/@auth/core/lib/actions/callback/handle-login.js:24:15)
at Module.callback (webpack-internal:///(rsc)/./node_modules/@auth/core/lib/actions/callback/index.js:181:142)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async AuthInternal (webpack-internal:///(rsc)/./node_modules/@auth/core/lib/index.js:43:24)
at async Auth (webpack-internal:///(rsc)/./node_modules/@auth/core/index.js:130:34)
[remaining lines omitted]
I can see the USER and SESSION records in the next-auth table as expected, but I'm not seeing an ACCOUNT.
How to reproduce
- Set up the repro app as described in the README.md of the reproduction repo
- Start with
npm run devand openhttp://localhost:3000 - A login form will appear. Enter a valid email address in the input and click the button.
- SendGrid should send a login email to the address. Once received, click the link.
- The process will appear to work, but you will not be logged in (
await auth()returnsnull). - Try steps 3-5 again with the same email.
- You'll get an error page, with an exception in the server console.
Expected behavior
Upon opening the magic link, the user should be logged in.