Bug description
https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/constructor#datasources
When attempting to connect to the prisma client which is configured with an explicit datasource location:
const prisma = new PrismaClient({
datasources: { postgresql: { url: "postgres://****:****@localhost:5432/****?schema=foo" } },
});
...
await prisma.$connect();
I get the following error:
(node:99546) UnhandledPromiseRejectionWarning: Error: error: Environment variable not found: DATABASE_URL.
--> schema.prisma:5
|
4 | datasource postgresql {
5 | url = env("DATABASE_URL")
|
Validation Error Count: 1
at Oe.Yu.default.on.c (/Users/timleslie/src/prisma-issue/node_modules/@prisma/client/engine-core/src/NodeEngine.ts:591:29)
at Oe.emit (events.js:197:13)
at Oe.EventEmitter.emit (domain.js:439:20)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Oe.Readable.push (_stream_readable.js:224:10)
at Oe.Transform.push (_stream_transform.js:151:32)
at Oe._pushBuffer (/Users/timleslie/src/prisma-issue/node_modules/@prisma/client/engine-core/src/byline.ts:116:17)
at Oe._transform (/Users/timleslie/src/prisma-issue/node_modules/@prisma/client/engine-core/src/byline.ts:107:8)
at Oe.Transform._read (_stream_transform.js:190:10)
(node:99546) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:99546) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
How to reproduce
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
datasource postgresql {
url = env("DATABASE_URL")
provider = "postgresql"
}
generator client {
provider = "prisma-client-js"
}
model User {
id Int @id @default(autoincrement())
name String?
}
Expected behavior
I would expect the client to never look for the DATABASE_URL environment variable if the override has been provided.
Environment & setup
- OS: OSX 10.15.6
- Database: PostgreSQL 12.2
- Node.js version: 12.11.0
- Prisma version: 2.7.1
Bug description
https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/constructor#datasources
When attempting to connect to the prisma client which is configured with an explicit datasource location:
I get the following error:
How to reproduce
Expected behavior
I would expect the client to never look for the
DATABASE_URLenvironment variable if the override has been provided.Environment & setup