question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`prisma db pull` doesn't read `.env` file and errors with Environment variable not found: DATABASE_URL

See original GitHub issue

Bug description

yarn prisma db pull report Environment variable not found: DATABASE_URL.

Prisma schema loaded from prisma/schema.prisma
Error: Get config: Schema Parsing P1012

error: Environment variable not found: DATABASE_URL.
  -->  schema.prisma:10
   | 
 9 |   provider = "postgresql"
10 |   url      = env("DATABASE_URL")
   | 

Validation Error Count: 1

.env: DATABASE_URL=“postgresql://user:pass@localhost:49154/db?schema=public”

How to reproduce

Expected behavior

read DATABASE_URL from .env correctly

Prisma information

Environment variables loaded from .env prisma : 3.9.0 @prisma/client : 3.9.0 Current platform : darwin-arm64 Query Engine (Node-API) : libquery-engine bcc2ff906db47790ee902e7bbc76d7ffb1893009 (at node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node) Migration Engine : migration-engine-cli bcc2ff906db47790ee902e7bbc76d7ffb1893009 (at node_modules/@prisma/engines/migration-engine-darwin-arm64) Introspection Engine : introspection-core bcc2ff906db47790ee902e7bbc76d7ffb1893009 (at node_modules/@prisma/engines/introspection-engine-darwin-arm64) Format Binary : prisma-fmt bcc2ff906db47790ee902e7bbc76d7ffb1893009 (at node_modules/@prisma/engines/prisma-fmt-darwin-arm64) Default Engines Hash : bcc2ff906db47790ee902e7bbc76d7ffb1893009 Studio : 0.457.0

Environment & setup

  • OS: macOS 12.2
  • Database: PostgreSQL 13
  • Node.js version: v14.18.1

Prisma Version


Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
millspcommented, Feb 2, 2022

Hey, this issue has been fixed in 3.9.1 which was just published. Thanks for reporting this!

3reactions
Jolg42commented, Feb 2, 2022

Hi @smoothdvd

Thanks for the report!

I can confirm this is a regression, we are working on a fix and are planning a patch release later today 🚢

Read more comments on GitHub >

github_iconTop Results From Across the Web

prisma - getting environment variable not found error message ...
If anybody running into this issue, just run npx prisma generate . This will re-establish the link between schema.prisma and .env file.
Read more >
Environment variables - Prisma
Example: Set the DATABASE_URL environment variable in an .env file. It is common to load your database connection URL from an environment variable:....
Read more >
Can't find DATABASE_URL during deployment - Fly.io
The error during deployment happens when it tries to run npx prisma ... #12 3.531 error: Environment variable not found: DATABASE_URL.
Read more >
Prisma 3.10.0 Release - GitClear
Best of all, the query is entirely type-safe! This scratches the surface of what's possible with embedded documents. You can read further in...
Read more >
Jokes App Tutorial - Remix
Set the DATABASE_URL in the .env file to point to your existing database. ... Environment variables loaded from .env Prisma schema loaded from ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found