Environment variables not available within application?

Issues information

Environment variables not available within application?

For some reason my env vars registered in the web console (scope=Application) aren’t available within my application when I run printenv via shell. They are all listed in the docker-compose.yml also, but for some reason aren’t being injected into the appliction’s environment.

Is there a step I’m missing? Thanks in advance.

Hi @schmoove , I think this thread will be useful.

Thanks for the quick response, but the issue isn’t in my Dockerfile, but the application’s code itself. Redis, MySQL etc, failing to connect due to empty environment variables.

Is there further info I can provide to assist in finding the issue? Thanks!

You can connect to your application with qovery shell command and run the command env to see the environment variables injected. Read this documentation to install the Qovery CLI.

Can you show me your environment variable configuration in Qovery? What are the environment variables that are empty? Can you give more details on how you get access to them into your app?

Thanks

Thanks for the follow-up, you can see we have Application-level environment vars set:

But if I run qovery shell and then env, none of them appear:

QOVERY_APPLICATION_Z99C65214_NAME=monolith
KUBERNETES_SERVICE_PORT=443
KUBERNETES_PORT=tcp://172.20.0.1:443
...

Did you redeploy your app? You need to redeploy your app to apply your env vars changes.

Yep, but the deployment fails because the environment vars aren’t registering in order for the app to start. Is the app falling back to a previous deployment when that happens?

There is 2 scenarios possible

Scenario 1

Let’s say you successfully deployed once your app and you deploy a new version that is failing to start - then we don’t need to rollback since your new version has not been successfully deployed, and your old app version is still running.

Scenario 2

You never succeed at deploying your app and you try to deploy a new version with no success. Then there is no application running. There is nothing to “rollback”.