The datasource property `directUrl` is no longer supported in schema files. Move connection URLs to
I just got this typescript error on datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}
6 Replies
You selected the bot's instantaneous insights. Let me compile your answer right away!
That error message is misleading:
datasource.directUrl is still supported in current Prisma versions.
The official docs and multiple guides actively show and recommend directUrl for setups that use connection poolers, including:
- General connection poolers / PgBouncer [External poolers]
- Supabase [Supabase docs]
- Neon [Neon docs]
- Prisma Accelerate [Accelerate getting started]
- Schema reference for datasource [Schema datasource; directUrl option]
A valid schema is for example:
If you see "directUrl is no longer supported" it likely comes from:
- A tool or plugin (e.g. an IDE extension or linter) that’s out of date or not using the correct Prisma version.
- A TypeScript type or custom code around Prisma that doesn’t know about directUrl.
What to do:
1. Ensure you’re using a Prisma version that supports directUrl (>= 4.10.0). [directUrl discussion]
2. Update your editor/Prisma VS Code extension and restart the TypeScript server.
3. Run npx prisma validate – if it passes, your schema is valid and the TS/IDE error is coming from tooling, not Prisma itself.
If npx prisma validate fails, please share that exact error.Once you have upgraded to Prisma 7,
url and directUrl would no longer be a valid attribute in datasource block of schema.prisma
The value of DIRECT_URL should go in the url value in datasource block of prisma.config.ts
and the value of DATABASE_URL should be passed to adapter while initialising Prisma ClientWhy couldn't the npx prisma match the version we are using? We are forced to update because of this mess.
And I still get
Error: The datasource property is required in your Prisma config file when using prisma generate --sqlnpx always works by fetching the newest version of whatever tool you are trying to run.
You could setup something that works via a script in your package json and running it via npm, that will use your installed version instead.
Alternatively you can specifiy the same version as you use locally, with npx, ie. npx prisma@6.13 ...Should've been automatic and checks the package.json if you ask me.
v7 is one hell of a breaking change. Enums are a nightmare to work with. I'm reverting to v6.
Hehe perhaps. I've certainly found myself confused about that behaviour before. But that's an issue you'll have to take up with the team behind
npm as that behaviour was always like this 😄
There are certainly breaking changes in v7, but they have been incrementally added in version 6.x, to smoothen the ride, but yeah if you jump directly I imagine there'd be a lot of issues.
I'm quite enjoying the tightening of enums, it matches better with how I'd expect them to work in Typescript. What issues are you having that makes them a nightmare to work with?