MongoDB ConnectorError: `Command failed (IllegalOperation): This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.)`
See original GitHub issueBug description
When I use Prisma to connect to MongoDB, there seems to be a problem. My connection URL is mongodb://localhost:27017/dao
, it works well in 2.26.0
. But after that version, like 2.27.0
or the latest version, It can’t connect my mongodb. As the information indicates, i make URL like mongodb://localhost:27017/dao?retryWrites=false
, It also like that.
PrismaClientUnknownRequestError3 [PrismaClientUnknownRequestError]:
Invalid `prisma.user.create()` invocation:
Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: RawError { code: "unknown", message: "Command failed (IllegalOperation): This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.)" } })
at cb (/Users/rain/WhiteMatrix/demo/prisma/dist/runtime/index.js:35947:17)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async main (/Users/rain/WhiteMatrix/demo/demo/demo.js:7:17) {
clientVersion: '2.29.0'
}
How to reproduce
- Create schema
- RUN
yarn prisma generate
- Run
node demo.js
- See error
Expected behavior
No response
Prisma information
datasource db {
provider = "mongodb"
url = "mongodb://localhost:27017/dao?retryWrites=false"
}
generator client {
provider = "prisma-client-js"
// MacOS Alpine Ubuntu18/Debian10+ Centos7+
binaryTargets = ["darwin", "linux-musl", "debian-openssl-1.1.x", "rhel-openssl-1.0.x"]
previewFeatures = ["mongodb", "referentialActions"]
output = "./dist"
}
enum UserRole {
Admin
Member
}
model User {
id String @id @default(dbgenerated()) @map("_id") @db.ObjectId
username String @unique
passwd String
role UserRole
created_at DateTime @default(now())
updated_at DateTime @updatedAt
}
Environment & setup
- OS: Mac OS
- Database: MongoDB 5
- Node.js version: v16.4.0
Prisma Version
prisma : 2.29.0
@prisma/client : 2.29.0
Current platform : darwin
Query Engine : query-engine 1be4cd60b89afa04b192acb1ef47758a39810f3a (at node_modules/@prisma/engines/query-engine-darwin)
Migration Engine : migration-engine-cli 1be4cd60b89afa04b192acb1ef47758a39810f3a (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core 1be4cd60b89afa04b192acb1ef47758a39810f3a (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary : prisma-fmt 1be4cd60b89afa04b192acb1ef47758a39810f3a (at node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash : 1be4cd60b89afa04b192acb1ef47758a39810f3a
Studio : 0.419.0
Preview Features : mongoDb, referentialActions
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
This MongoDB deployment does not support retryable writes ...
Please add retryWrites =false to your connection string. When I hit this api on remote environment, then it runs fine. I am using...
Read more >Retryable Writes — MongoDB Manual
Prior to MongoDB 4.2, MongoDB retryable writes did not support retrying upserts which failed due to duplicate key errors. Diagnostics. The serverStatus command, ......
Read more >MongoDB deployment does not support retryable writes - Reddit
hello, I can't use Prisma studio with a mongodb deployment. Prisma return to me an error : Message: Invalid \prisma.user.create()` ...
Read more >MongoDB 3.6 Retryable Writes . . . Retryable Writes - Percona
Generally, you enable the use of Retryable Writes by adding the 'retryWrites=' flag to your MongoDB connection string that is passed to your...
Read more >Lightning Fast Guide on Prisma MongoDB Connection using ...
... "Command failed (IllegalOperation): This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your ...
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
Related to #8266
You currently need a mongodb instance with replica set in order to use Prisma. You can use the free tier atlas cluster or the mongodb docker image.
This is due to the replicaSet not being configured. We’re working on docs for this and a better error message, but for now either: