Skip to content

Runtime Error: Authentication crash when using PrismaAdapter (mongodb) - TypeError: Cannot read properties of undefined (reading 'exec') #12731

Open
@th3f0r3ign3r

Description

@th3f0r3ign3r

Environment

System:
    OS: macOS 15.3.1
    CPU: (8) arm64 Apple M2
    Memory: 1.02 GB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
    npm: 11.1.0 - ~/.nvm/versions/node/v22.14.0/bin/npm
    Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
  Browsers:
    Safari: 18.3
  npmPackages:
    @auth/prisma-adapter: ^2.8.0 => 2.8.0
    next: 15.2.0 => 15.2.0
    next-auth: ^5.0.0-beta.25 => 5.0.0-beta.25
    react: ^19.0.0 => 19.0.0

Reproduction URL

https://github.com/th3f0r3ign3r/authjs-issue.git

Describe the issue

I have setting up Auth.js with Github Oauth and I decided to add PrismaAdapter with (mongodb) to save user account information. Without adding the adapter everything working great. But when I added the Adapter to @/auth it crash

Image

Image

CleanShot.2025-03-04.at.19.35.44.mp4

How to reproduce

  1. Clone the project
  2. Create a Github App (CLIENT_ID & CLIENT_SECRET)
  3. Create a MongoBD account and get a connection string
  4. Add them to the .env.local & run npx prisma generate
  5. Go to src/auth/index.tscomment the adapters line
  6. Launch the project clear && npm run dev don’t forget to run npm i
  7. Click on the Signin with GitHub
  8. After being logged signOut
  9. Uncomment the adapter line
  10. Refresh your browser

If you follow all these steps normally you will have the same error

Expected behavior

Normally they should not have any error. Instead I am doing something wrong but I follow the guide line per line. 😩😩😩

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions