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.

Misleading env error on client binaryTargets

See original GitHub issue

Problem

I normally build different Prisma clients for different environments e.g. darwin or rhel-openssl-1.0.x. As a result, I use an environment variable on the client.binaryTargets field in the schema file. However, it always shows squiggly red lines saying the environment variable does not exist:

Screen Shot 2021-02-18 at 11 28 30 pm

Note how the db.url field is also using environment variable but is not seen as errors.

Suggested solution

Can we treat the client.binaryTargets the same as the db.url field please 😃 ?

Alternatives

Alternatively, I think we can start vscode with the environment variable but it’s not recommended

Additional context

This is not actually causing errors when running commands in CLI if env variables are supplied correctly. This just shows the schema file as if there’s always an error which potentially hides other errors

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Jolg42commented, Mar 15, 2022

Was probably fixed since it was reported.

0reactions
Jolg42commented, Mar 15, 2022

Could not reproduce the squiggly red lines with most recent version with

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

generator client {
  provider        = "prisma-client-js"
  binaryTargets   = [env("SOMETHING")]
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected binaryTargets environment variables usage #8112
Bug description In version 2.22 and below, I was able to use an environment variable to set binaryTargets. This was the generator part...
Read more >
Prisma schema (Reference)
Accessing environment variables from the schema. You can use environment variables to provide configuration options when a CLI command is invoked, or a...
Read more >
Intermittent prisma crashes - RedwoodJS Community
Hi Prisma Team! My Prisma Client just crashed. This is the report: Versions Name Version Node v14.4.0 OS linux-musl Prisma 2.0.1 Logs 2020-06- ......
Read more >
How to fix Prisma Client getting undefined for custom model
But it was the first one that fixed the exact error you stated above. ... not referring any wrong path while importing the...
Read more >
Has anyone received the following error message Query create
prisma:tryLoadEnv Environment variables loaded from /app/project/.env +0ms ... libraryStarted: false +62ms prisma:client:libraryEngine Search for Query ...
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