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.

Regression in loading .env file from 2.2.0 to 2.2.2 for prisma/cli

See original GitHub issue

Bug description

When upgrading from @prisma/cli from 2.2.0 to 2.2.2 it does not load the .env file from the working directory, like the prisma client does. We already had prisma-client at 2.2.2 because dependabot merged that PR first.

Fun fact: if you put the DATABASE_URL from the .env file back in the prisma/.env file, the client doesn’t work any more (because it doesn’t have the DATABASE_URL) but npx prisma migrate up works again 🤷 .

How to reproduce

Breaking CLI:

  1. Upgrade CLI and Client to 2.2.2
  2. Place a .env file with the DATABASE_URL in the working directory, and none in prisma/.
  3. run regular prisma code -> it works
  4. run npx migrate up --experimental -> it breaks

Breaking the normal client:

  1. Upgrace CLI and Client to 2.2.2
  2. Create a prisma/.env file with the DATABASE_URL and no .env file in the working directory.
  3. run regular prisma code -> it breaks (using the default empty constructor new PrismaClient())
  4. run npx migrate up --experimental -> it works again

Environment & setup

  • OS: Mac OS
  • Database: Postgres
  • Prisma version: 2.2.2
  • Node.js version: 14.4

Related to #2971

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
janpiocommented, Jul 21, 2020

In Setup 2, Prisma Client should totally work if you have env("DATABASE_URL") in your schema.

If not, can you create a super simple project reproducing the problem and just put it on GitHub so we can verify?

1reaction
alexnederlofcommented, Aug 3, 2020

Sorry guys haven’t found the time to isolate the issue in a fresh repo. I’ll try to do it in the coming weeks, but feel free to close the issue and have me re-open it if I can confirm, if that helps you manage this repo better!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues
Load the env file from the prisma folder as before. Environment & setup. OS: Mac OS; Database: PostgreSQL; Prisma version: 2.2; Node.js version: ......
Read more >
Environment variables
Any environment variables defined in that .env file will automatically be loaded when running a Prisma CLI command. Do not commit your .env...
Read more >
Prisma - Getting Environment Variable Not Found Error ...
Any environment variables defined in that.env file will automatically be loaded ... Regression in loading.env file from 2.2.0 to 2.2.2 for prisma/cli #3086 ......
Read more >
Not reading ENV variables in database.yml (Rails 4.2.0, ...
The issue was solved by putting two lines in my application.rb file to load Dotenv earlier: ... Bundler.require(*Rails.groups) #### ...
Read more >
Environment variables — dynaconf 2.2.3 documentation
To override the configuration parameter {param}, use an environment ... values in a .env file located in the same directory as your settings...
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