[wrong error msg]: Transactions are not supported by this deployment
See original GitHub issueBug description
When I use Prisma to connect to MongoDB replica set, there seems to be a problem. My connection URL is mongodb://root:prisma@localhost:27017/prisma-mongo. It can’t connect my mongodb. I received an error like that.
PrismaClientUnknownRequestError3 [PrismaClientUnknownRequestError]:
Invalid `prisma.user.create()` invocation:
Error in connector: Database error. error code: unknown, error message: Transactions are not supported by this deployment
at cb (E:\Desktop\tessttttttt\prisma-examples\databases\mongodb\node_modules\@prisma\client\runtime\index.js:36378:17)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
clientVersion: '2.29.1'
}
After that, I researched and changed my connection URL to mongodb://root:prisma@localhost:27017/prisma-mongo?authSource=admin&retryWrites=true&w=majority, it works fine. I realized that the error was caused by my connection missing authSource=admin
.
Docker image run Mongo replica set here.
How to reproduce
- Run Mongo replica set on Docker
- Create schema
- Run npx prisma generate
- Run node demo.js
- See error
Expected behavior
Maybe I should be received an authentication error instead of transactions are not supported by this deployment. Because my connection URL is missing authSource=admin
which is not related to transaction in db.
Prisma information
datasource db {
provider = "mongodb"
url = env("mongodb://root:prisma@localhost:27017/prisma-mongo")
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["mongodb"]
}
model User {
id String @id @default(dbgenerated()) @map("_id") @db.ObjectId
createdAt DateTime @default(now())
firstName String
lastName String?
email String @unique
}
Environment & setup
- OS: Windows 10
- Database: MongoDB
- Node.js version: v12.18.4
- Docker version: 19.03.13, build 4484c46d9d
Prisma Version
prisma : 2.29.1
@prisma/client : 2.29.1
Current platform : windows
Query Engine : query-engine 1be4cd60b89afa04b192acb1ef47758a39810f3a (at node_modules\@prisma\engines\query-engine-windows.exe)
Migration Engine : migration-engine-cli 1be4cd60b89afa04b192acb1ef47758a39810f3a (at node_modules\@prisma\engines\migration-engine-windows.exe)
Introspection Engine : introspection-core 1be4cd60b89afa04b192acb1ef47758a39810f3a (at node_modules\@prisma\engines\introspection-engine-windows.exe)
Format Binary : prisma-fmt 1be4cd60b89afa04b192acb1ef47758a39810f3a (at node_modules\@prisma\engines\prisma-fmt-windows.exe)
Default Engines Hash : 1be4cd60b89afa04b192acb1ef47758a39810f3a
Studio : 0.419.0
Preview Features : mongoDb
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Make the MongoDB Replica Set Requirement Optional in ...
Problem MongoDB only allows you to start a transaction on a replica set. ... [wrong error msg]: Transactions are not supported by this...
Read more >This MongoDB deployment does not support retryable writes ...
When I hit this api on my local environment, I get following error: MongoError: This MongoDB deployment does not support retryable writes.
Read more >Retryable Writes — MongoDB Manual
The write operations inside the transaction are not individually retryable, regardless of value of retryWrites . For more information on transactions, see ...
Read more >You receive an error message when you run a SQL Server ...
The application is trying to load a version of Compact that is incompatible with the version that is installed on the computer. Incorrect...
Read more >Understanding and resolving MetaMask error codes
'4200': { standard: 'EIP-1193', message: 'The requested method is not supported by this Ethereum provider.', },.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The problem is that this message comes from Mongo directly. Seems that without
authSource=admin
the database indeed does not support transactions, but unfortunately does not mention that in the error message.@janpio @pantharshit00 Sorry you can’t reproduce the exact error I got, but I’m still getting the error as mentioned if the database connection string is missing
authSource=admin
. Here is the docker-compose.yml file that I used to create a MongoDB replica instance. Hope it can help you to reproduce the error