PAYLOAD_PUBLIC not propagating to collections? #1283
-
Hey! Quick question from my side, perhaps I am doing something wrong here. I have an env var called
When I run my app locally, environment variable gets propagated, but on PRODUCTION it is undefined. What is even weirder is that other environment vars I pass to my docker container work. What is yet even weirder is that the same variable in payload.init() gets logged with the actual value.
Is there something that might be preventing collections to access process, but not Thanks for any kind of feedback! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Addition: It works correctly if I supply this variable during docker-build. But this seems widely inconsistent, as it works in server.ts without it |
Beta Was this translation helpful? Give feedback.
-
Hey @adam-mrozik — I have some thoughts for you. Are you using
You can circumvent this problem by specifying a |
Beta Was this translation helpful? Give feedback.
Hey @adam-mrozik — I have some thoughts for you.
Are you using
dotenv
? Make sure that yourdotenv
correctly points to your.env
file in both dev and production. Often times we've seen it where, for whatever reason, the folder structure differs from/src
to/dist
if using TS, and thendotenv
can no longer find your.env
file.dotenv
unfortunately won't error if it can't find the.env
....It just simply won't bind any variables.You can circumvent this problem by specifying a
path
todotenv
that you are SURE points to your.env
file in production cases.