Next.js Discord

Discord Forum

kubernetes and docker deployment next js app

Unanswered
Jersey Wooly posted this in #help-forum
Open in Discord
Jersey WoolyOP
Hello community
We are currently facing an issue with environment variables in our Next.js application. The problem arises from our use of public environment variables for API access, specifically NEXT_PUBLIC_API_URL, which are inlined into the JavaScript bundle and need to be populated during the Next.js build process. However, we are injecting these variables at runtime in our Kubernetes (K8S) environment, leading to an undefined value in the development environment.
To address this, I explored possible solutions for injecting environment variables at runtime and found relevant information in the Next.js documentation: Runtime Environment Variables.
We need someone with experience in handling this issue to help us achieve the goal of deploying a single image across multiple environments.
Thank you.

0 Replies