next-auth icon indicating copy to clipboard operation
next-auth copied to clipboard

Next-auth <> Prisma <> Mongo Atlas Serverless

Open Christopher-Stevers opened this issue 6 months ago • 0 comments

Adapter type

@auth/prisma-adapter

Environment

  System:
    OS: Windows 10 10.0.19045
    CPU: (6) x64 Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz
    Memory: 957.36 MB / 15.93 GB
  Binaries:
    Node: 20.12.2 - C:\Program Files\nodejs\node.EXE
    npm: 10.5.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.13.1 - ~\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.19041.4355

Reproduction URL

https://github.com/Christopher-Stevers/next-auth-example

Describe the issue

Ever since migrating from digital oceans' hosted mongodb offering we've been running into login issues with next-auth. They occur occasionally and are impossible to reproduce, but they seemed to have started showing up only after we migrated. For the user this means they can't login when they try to and we are getting logs similar to this

Invalid `prisma.account.upsert()` invocation:

Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: RawDatabaseError { code: "unknown", message: "unexpected end of file" } })

How to reproduce

Run next auth with prisma and mongodb atlas serverless in a production environment and run enough users through until it shows up. It seems to be happening to some users more than others but that could just be their frequency of use.

Expected behavior

We need some sort of fallback so our users can still sign in. The database connector for auth should either work or be optional in that users can still access the app even if that part of the sign in isn't working.

Christopher-Stevers avatar Aug 24 '24 21:08 Christopher-Stevers