question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prisma does not support Mongodb SCRAM-SHA-256 authentication mechanism

See original GitHub issue

Bug description

My Db uses SCRAM-SHA-256 as the authentication mechanism. I can connect to it using Mongo Compass, but Prisma cannot connect. image

How to reproduce

  1. set the environment variable DATABASE_URL="mongodb://*****:*****@*.*.*.*:3051/message_db&authSource=message_db&authMechanism=SCRAM-SHA-256?authSource=message_db&readPreference=primary&appname=MongoDB%20Compass&directConnection=true&ssl=false"
  2. npx prisma studio
  3. image

Expected behavior

No response

Prisma information

The normal operation

datasource db {
  provider = "mongodb"
  url      = env("DATABASE_URL")
}

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["mongoDb"]
}

Environment & setup

  • OS:
  • Database:
  • Node.js version: OS: Debian Database: Mongo Node.js version: v14.17.5

Prisma Version

prisma                  : 3.0.2
@prisma/client          : 3.0.1
Current platform        : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at ../../../../../.npm/_npx/3091863/lib/node_modules/prisma/node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine        : migration-engine-cli 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at ../../../../../.npm/_npx/3091863/lib/node_modules/prisma/node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine    : introspection-core 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at ../../../../../.npm/_npx/3091863/lib/node_modules/prisma/node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary           : prisma-fmt 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at ../../../../../.npm/_npx/3091863/lib/node_modules/prisma/node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash    : 2452cc6313d52b8b9a96999ac0e974d0aedf88db
Studio                  : 0.423.0
Preview Features        : mongoDb

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
pantharshit00commented, Nov 11, 2021

Yes, you specify parameters in the connection string format after ? and join multiple of them using &.

Looks like this is resolved then.

0reactions
fuergaosi233commented, Nov 11, 2021

I think I found the problem. image I change the & of my Url to ? then the service can be accessed normally.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MongoDB Users and Authentication - Create, List, and Delete
Find out how to configure user accounts and set up authentication credentials on your MongoDB server, including how to create, delete, and show...
Read more >
Authentication Mechanisms — Node.js - MongoDB
SCRAM -SHA-256 is a salted challenge-response authentication mechanism (SCRAM) that uses your username and password, encrypted with the SHA-256 algorithm to ...
Read more >
I cant start a project with Prisma with local Mongodb
You probably need to fix the URI. The standard mongodb URI connection scheme has the form: mongodb://[username:password@]host1[:port1][,.
Read more >
Authentication and DB access with Next, Prisma, and MongoDB
A MongoDB Database. Make sure that your MongoDB deployment is configured with replica sets to be able to integrate with Prisma. You can...
Read more >
Password authentication | YugabyteDB Docs
Password authentication · Password authentication methods · YugabyteDB database passwords · Enable SCRAM-SHA-256 authentication · Create a cluster that uses SCRAM- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found