RedwoodJS application - Missing ENV variables on the web workspace side

Hi Team,

I have followed the redwoodjs environment variables, fly environment variables set up and I’m not able to pull the env variables on the frontend side… however the env variables works well on the local machine after running the build file…

This is what I’m getting when i am trying to print the env variable on the browser console
MISSING_ENV_VAR

Please let me know if you need any further information.

I’m not that known to Redwood but I have a guess that might help.

I assume your redwood Dockerfile builds your frontend.

So what happens is that fly secrets are only set at runtime not on build time so you can’t use envs from secrets inside your Dockerfile processes, for that you need build args.

I’ve wrote how to do it for NextJS and might just help you on redwood too: https://fly.io/docs/languages-and-frameworks/nextjs/#what-about-build-time-environment-variables

1 Like

this was super helpful… worked really well, thanks for the super quick reply… appreciate it @lubien

1 Like