coollabsio / coolify

An open-source & self-hostable Heroku / Netlify / Vercel alternative.
https://coolify.io
Apache License 2.0
33.89k stars 1.83k forks source link

[Bug]: Predefined environment variables not passed to Nixpacks #2653

Open sillvva opened 4 months ago

sillvva commented 4 months ago

Description

I pushed a PR to test predefined environment variables to a preview deployment on my Sveltekit app. The environment variables are being passed to Nixpacks as literal strings rather than being replaced with the predefined values.

I followed the instructions here: https://coolify.io/docs/knowledge-base/environment-variables

Minimal Reproduction (if possible, example repository)

Example variables:

TEST_URL=$COOLIFY_URL
PUBLIC_TEST_URL=$COOLIFY_URL

Build variable is checked. Is Literal? is not checked.

image

Exception or Error

The resulting Final Nixpacks plan looks like this:

Final Nixpacks plan: {
"providers": [],
"buildImage": "ghcr.io\/railwayapp\/nixpacks:ubuntu-1716249803",
"variables": {
"SOURCE_COMMIT": "8887ff2d43fa705c29557d55a2320a50b95f36eb",
...HIDDEN_REAL_VARIABLES...
"PUBLIC_TEST_URL": "$COOLIFY_URL",
"TEST_URL": "$COOLIFY_URL",
"CI": "true",
"NIXPACKS_METADATA": "node",
"NODE_ENV": "production",
"NPM_CONFIG_PRODUCTION": "false"
},

And the resulting environment variables look like this with console.table:

#14 13.85 Coolify check: process.env
#14 13.85
#14 13.85 ┌─────────────────┬────────────────┐
#14 13.85 │ (index) │ Values │
#14 13.85 ├─────────────────┼────────────────┤
#14 13.85 │ PUBLIC_TEST_URL │ '$COOLIFY_URL' │
#14 13.85 │ TEST_URL │ '$COOLIFY_URL' │
#14 13.85 └─────────────────┴────────────────┘

Version

v4.0.0-beta.297

Aunali321 commented 4 months ago

i thought i was going crazy

jacobschwantes commented 4 months ago

Also facing this issue. The environment variable is getting set correctly in the container but $coolify_url is what gets passed if its marked as a build variable.

lorenzomigliorero commented 3 months ago

Probably related to https://github.com/coollabsio/coolify/issues/2316

seloElo commented 1 week ago

Still have the issue today on last beta