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.

Provide a way to disable env conflicts warning

See original GitHub issue

Problem

In some settings, it might be necessary to disable .env conflict warning.

For example, a monorepo could have a .env file at the root and also symlink it inside a monorepo package. In this case, disabling .env conflict warnings is completely reasonable.

For example, running Nest.JS tests with jest will print this warning for each test file (as jest runs each test file in a separate worker) which is very noisy: image

Suggested solution

Provide a way to disable env warnings.

Alternatives

No user-space workaround is possible as the check is hardcoded in the generated code: https://github.com/prisma/prisma/blob/698ce54d3d5e6d4635263d5709bfcc7d32a146a5/packages/client/src/generation/TSClient/TSClient.ts#L140-L148

https://github.com/prisma/prisma/blob/ba74c81fdbc9e6405946fdc6f9d42d103d008dc2/packages/client/src/runtime/warnEnvConflicts.ts#L3-L5

Additional context

prisma@3.2.1

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
PabloSzxcommented, Feb 3, 2022

any news on this?, when doing testing, watching this warning repeated a million times gives too much noise, when in practice there is literally no actual env conflict because every .env is symlinked

1reaction
VanTanevcommented, Oct 11, 2022

I suggest people look at https://www.npmjs.com/package/patch-package for a workaround.

From: Andy Young @.> Sent: Wednesday, October 5, 2022 1:51:42 PM To: prisma/prisma @.> Cc: Ivan Tanev @.>; Author @.> Subject: Re: [prisma/prisma] Provide a way to disable env conflicts warning (#9726)

Hacky workaround to suppress this error within automated tests if you’re using Jest - by mocking out the warning function(!)

(Likely translatable to other testing libraries if you’re not using Jest.)

prisma_mock.ts:

import prismaClient from @./client"; @./client/runtime/index.js", () => { const defaultMethods = jest.requireActual( @.***/client/runtime/index.js" );

return { __esModule: true, …defaultMethods,

// suppress needless prisma warning
// "Conflict for env var CORE_DATABASE_URL in ../../.env and .env".
// - track https://github.com/prisma/prisma/issues/9726 for

potential better solution warnEnvConflicts: () => undefined, };}); export default prismaClient;

— Reply to this email directly, view it on GitHub https://github.com/prisma/prisma/issues/9726#issuecomment-1268269747, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABROHZEMFV3RN2TP7LMSRLWBVMT5ANCNFSM5F2HXXEQ . You are receiving this because you authored the thread.Message ID: @.***>

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I disable a Pylint warning? - python - Stack Overflow
pylint --generate-rcfile shows it like this: [MESSAGES CONTROL] # Enable the message, report, category or checker with the given id(s).
Read more >
Resolving Conflicts - ServiceNow Developers
When a file is locked for editing to avoid conflicts, a developer can: View differences: Click the View differences link in the warning...
Read more >
Found conflicts between different versions of 'assembly' that ...
This error occurs during a build when more than one version of the same dependent assembly is referenced in a build of the...
Read more >
How to Resolve GitHub Merge Conflicts | Cloudbees Blog
2. Conflicts From Pulling Remote Changes to a Local Repository · Now you have basically two choices to resolve your conflict: · Essentially,...
Read more >
Merge conflicts - GitLab Docs
Methods of resolving conflicts · Interactive mode: UI method best for conflicts that only require you to select which version of a line...
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