P
Prisma6mo ago
Mike

adapter-mongodb

I’ve been trying to implement and use a custom adapter-mongoDB for Prisma, but I'm encountering the following error:
err: {
"type": "PrismaClientConstructorValidationError",
"message": "\"adapter\" property can only be provided to PrismaClient constructor when \"driverAdapters\" preview feature is enabled.\nRead more at https://pris.ly/d/client-constructor",
"stack":
PrismaClientConstructorValidationError: "adapter" property can only be provided to PrismaClient constructor when "driverAdapters" preview feature is enabled.
Read more at https://pris.ly/d/client-constructor
err: {
"type": "PrismaClientConstructorValidationError",
"message": "\"adapter\" property can only be provided to PrismaClient constructor when \"driverAdapters\" preview feature is enabled.\nRead more at https://pris.ly/d/client-constructor",
"stack":
PrismaClientConstructorValidationError: "adapter" property can only be provided to PrismaClient constructor when "driverAdapters" preview feature is enabled.
Read more at https://pris.ly/d/client-constructor
However, my Prisma schema does include the necessary preview feature:
generator client {
provider = "prisma-client-js"
output = "../generated/mongo"
previewFeatures = ["driverAdapters", "queryCompiler"]
}

generator client {
provider = "prisma-client-js"
output = "../generated/mongo"
previewFeatures = ["driverAdapters", "queryCompiler"]
}

So it seems like Prisma isn’t recognizing that driverAdapters is enabled, even though it's clearly specified in the generator block. Any ideas on what might be causing this or how to resolve it?
3 Replies
Prisma AI Help
Prisma AI Help6mo ago
You're in no rush, so we'll let a dev step in. Enjoy your coffee, or drop into #ask-ai if you get antsy for a second opinion!
Mike
MikeOP6mo ago
oh... sorry, I see the following: I can't create custom adapters for a non-SQL database...
Nurul
Nurul6mo ago
Thanks for creating the feature request: https://github.com/prisma/prisma/issues/27432 🙏
GitHub
Create a custom adapters for a non-SQL databases. (mongodb, etc...)...
Feature Summary Add the possibility to create custom adapters for a non-SQL databases as mongodb to support new architecture (queryCompiler/driverAdapters/Rust-Free ORM). Use Cases & Problem De...

Did you find this page helpful?