https://cal.com logo
#developers
Title
# developers
t

Thang Vu

03/01/2022, 4:30 AM
Hello, team! I’m very excited to join the community. I have a question for setting up the development environment. I followed the instruction here: https://github.com/calcom/cal.com#development: copied the
.env
files and ran
yarn dx
, but I got:
Copy code
@calcom/web:dx:     '  error: Environment variable not found: DATABASE_URL.\n' +
@calcom/web:dx:     '  -->  schema.prisma:6\n' +
@calcom/web:dx:     '   | \n' +
@calcom/web:dx:     ' 5 |   provider = "postgresql"\n' +
@calcom/web:dx:     ' 6 |   url      = env("DATABASE_URL")\n' +
@calcom/web:dx:     '   | \n' +
@calcom/web:dx:     '\n' +
This error is gone if I add
DATABASE_URL
to
apps/web/.env
. Am I (or the docs) missing anything? 🤔
p

Peer

03/01/2022, 8:43 AM
@zomars
👍 1
a

Agusti

03/01/2022, 11:54 AM
I needed to add db url myself to root env too
I think yarn dx gives preference to root
Can you try adding to root .env ?
👀 1
t

Thang Vu

03/01/2022, 12:10 PM
Just tried adding
DATABASE_URL
to root
.env
, doesn’t work for me. Same error
a

Agusti

03/01/2022, 12:49 PM
and in apps/web ? Sorry !
t

Thang Vu

03/01/2022, 1:12 PM
No worries, apps/web works, which is what I would expect. Should I raise a small PR to add it back in
apps/web/.env.example
? I wonder what is the reason behind putting it in
packages/prisma
🤔
a

Agusti

03/01/2022, 1:15 PM
@Thang Vu Thank you Thang 😃, lets ping @zomars which is leading the monorepo transition, I think we had good reason to have it in prisma package, but we need to make sure that .env is correctly passed from the package to other packages requiring it
👍 1
t

Thang Vu

03/01/2022, 1:23 PM
My bad, it seems like the env is required in both
packages/prisma
and
apps/web
. Without it,
packages/prisma
would fail its own Prisma commands
❤️ 1
a

Agusti

03/01/2022, 1:37 PM
Regardless we might need to either fix that or be more explicit about it in the docs/README/env files itself, thanks for reporting Thang
t

Thang Vu

03/01/2022, 1:54 PM
Happy to help, @Agusti 😄
❤️ 1
z

zomars

03/01/2022, 3:20 PM
The env variables is taken from the directory where the command is being called from
👍 2
That’s why we should try to run everything from root
❤️ 1
And I only set the variable on prisma/.env
a

Agusti

03/01/2022, 3:56 PM
Btw I think we can explicitly allow some env vars in next.config if we want to so they don't need to be explicitly PUBLIC
z

zomars

03/01/2022, 3:58 PM
Yeah, but we're trying to avoid that and also we like the public variables should be explicit
t

Thang Vu

03/02/2022, 1:43 AM
3 Views