You don't have any datasource defined in your schema.prisma.
I'm trying to migrate to the new prisma.config.ts as outlined in the latest announcement. I'm running into this error.
This is my prisma.config.ts
Is it because I have the "schema" defined? My understanding is that I don't nee dto have it defined in schema.prisma anymore? Am I incorrect (as usual)? ðŸ˜
3 Replies
Skipping coffee for instant knowledge! Let's brew that AI answer now.
You still need to define a datasource block in your schema.prisma file. The prisma.config.ts file does not replace the need for a datasource in the schema itself. The error message you’re seeing:
means that your schema.prisma is missing the required datasource block. The Prisma CLI and engines still expect the datasource to be defined in the schema.prisma file, even if you are using prisma.config.ts for configuration. The config file can help with things like specifying the schema location, migrations path, and seeding, but it does not inject the datasource into the schema automatically.
You must add a datasource block to your schema.prisma, for example:
The url field can reference an environment variable, and you can load it with dotenv as you are doing in your config, but the block itself must exist in the schema.prisma file. This is confirmed by the documentation and error messages you are seeing Prisma schema reference.
So, to resolve the error, add the datasource block to your schema.prisma. The prisma.config.ts does not remove the need for this block in the schema file itself.
Oh.. hmm
✅ Great, thanks for letting us know that this solved your question!