Thanks to visit codestin.com
Credit goes to github.com

Skip to content

environment variables are not picked in the client side code #60

@vishnoianil

Description

@vishnoianil

Deployment of the UI app in the container (in kubernetes) mounts the .env file as a secret. All the environment variable defined in .env are exported as env variable in the container. Client side code is build statically, so it inlines the env variable values at the build time. But the container image is public through github actions with no .env files, and due to that the client side codes is statically build with empty values and that result in failure of some UI features.

We can locally build images with the relevant .env files for each deployment environment (qa, prod) and use those images for deployment, but it's too cumbersome and not good practice.

Other option is to ensure we always use app router or getServerSideOpt to get the environment variables as mention in the next.js documentation here.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions