You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The BUILD_GRAPHQL_URL and/or EXTERNAL_GRAPHQL_URL env var is being baked into the JS bundle, likely due to the Next.js / webpack / static build. This bakes unchangeable configuration into the app, which leads to the built docker image on docker hub, being useless if you aren't using the default variables.
Part of the solution for enabling the Next.js static build was maintaining a .env.prod to supply those variables at build time for the production build. This env file is an anti-pattern for the following reasons.
Promotes a dangerous practice of committing environment vars to a repo in a plain text file.
Ties configuration to dev/prod when the build should have not care which system it's building for. The built app should run the same if you point it to your dev or production API.
ENV vars should always come from the system, and never be in a file that is committed to source control. The .env and .env.example files are a convenience local development only.
Because of the .env.prod file and the Next.js static build process, we're not able to use our generic Docker image published to Docker hub to run in our test environments, and generic users cannot use it as is without rebuilding.
Remove .env.prod and make the build not dependent on that file. It should get its vars from the environment, whether you put them there in a prefix to the command, or cat them into the env, or set them in CI.
Fix the issue where the GraphQL urls are being baked into the built JS bundle.
Maybe proxy GraphQL requests through a Next.js API route so we can take advantage of system environment vars
Type: critical
This is a blocker for releases
Describe the bug
The
BUILD_GRAPHQL_URLand/or EXTERNAL_GRAPHQL_URL env var is being baked into the JS bundle, likely due to theNext.js/webpack/ static build. This bakes unchangeable configuration into the app, which leads to the built docker image on docker hub, being useless if you aren't using the default variables.Part of the solution for enabling the
Next.jsstatic build was maintaining a.env.prodto supply those variables at build time for the production build. This env file is an anti-pattern for the following reasons.ENV vars should always come from the system, and never be in a file that is committed to source control. The
.envand.env.examplefiles are a convenience local development only.Because of the
.env.prodfile and theNext.jsstatic build process, we're not able to use our generic Docker image published to Docker hub to run in our test environments, and generic users cannot use it as is without rebuilding.Expected behavior
Next.js. This might be related to Optionally allow blocking fallback rendering #716.env.prodand make the build not dependent on that file. It should get its vars from the environment, whether you put them there in a prefix to the command, orcatthem into the env, or set them in CI.Next.jsAPI route so we can take advantage of system environment vars