Env vars not set correctly
bertvereecken
TRIALOP

a year ago

Hi

I have a monorepo setup with turborepo.
My monorepo contains two apps:

  • backend (hono nodeJS server)

  • admin dashboard (Vite React frontend).

I have two services in my Railway project

  • FE
    --- has a custom build command: pnpm build:frontend
    --- has a custom start command: pnpm start:frontend

  • BE
    --- has a custom build command: pnpm build:backend
    --- has a custom start command: pnpm start:backend

My backend crashes because I parse my process.env with 'zod' (JSON validator). I do this to warn me upfront when my env vars are somehow not OK.
However, I do log my process.env before the parsing and see that my ENV vars are not set. (according to the log statement).

I have set my env variables and tried deploying several times already. Without any success.

Does someone has any clues on what I might be doing wrong.

Thanks in advance for any help 🙂

Solved

8 Replies

bertvereecken
TRIALOP

a year ago

4838d5a0-e5bd-482c-bbf8-35740edea841


brody
EMPLOYEE

a year ago

hello,

you may want to check out these docs -


bertvereecken
TRIALOP

a year ago

Waaauw, this was it. I had read this a couple of weeks ago. But didn't pop in my mind.


bertvereecken
TRIALOP

a year ago

Still in strict mode right now, just added the env vars in my start task as well. They were only in my build task….


bertvereecken
TRIALOP

a year ago

Thanks for the tip again @Brody


brody
EMPLOYEE

a year ago

no problem!


bertvereecken
TRIALOP

a year ago

Just adding this here for any future people with the same problem 🙂

1320841306179768300


brody
EMPLOYEE

a year ago

!s


Status changed to Solved brody • about 1 year ago


Loading...