Skip to content

Root .env variables aren't available to prisma in monorepo #12535

@zomars

Description

@zomars

Bug description

We have a monorepo using turbo repo with the following structure:

image

The prisma package is being used in multiple applications, currently we're trying to use a single .env to avoid confusion. Moving the DATABASE_URL url from packages/prisma/.env to the root .env errors when trying to run any yarn prisma script.

We also tried to use a solution like cmd-env:

image

But no luck so far.

image

How to reproduce

  1. Have a monorepo with and .env file at the root
  2. Have something like packages/prisma in a monorepo package
  3. Set DATABASE_URL in the root .env file.
  4. Try to run any yarn prisma command.

Expected behavior

Being able to use the monorepo DATABASE_URL without having to set it up in packages/prisma/.env.

Prisma information

https://github.com/calcom/cal.com/blob/main/packages/prisma/schema.prisma

Environment & setup

  • OS: Mac OS 12
  • Database: PostgreSQL
  • Node.js version: v14.17.6

Prisma Version


prisma                  : 3.10.0
@prisma/client          : 3.10.0
Current platform        : darwin
Query Engine (Node-API) : libquery-engine 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
Migration Engine        : migration-engine-cli 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine    : introspection-core 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary           : prisma-fmt 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash    : 73e60b76d394f8d37d8ebd1f8918c79029f0db86
Studio                  : 0.458.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions