Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 15, 2026

What is this PR about?

Stack compose deployments were failing to resolve environment-scoped variables (e.g., ${{environment.FOO}}), throwing "Invalid environment variable: environment.FOO". Docker-compose deployments worked correctly.

The getExportEnvCommand function (Stack-specific) was missing the third parameter when calling getEnviromentVariablesObject:

// Before - missing environment.env parameter
const envVars = getEnviromentVariablesObject(
  compose.env,
  compose.environment.project.env,
);

// After - now includes environment.env
const envVars = getEnviromentVariablesObject(
  compose.env,
  compose.environment.project.env,
  compose.environment.env,
);

This aligns Stack behavior with docker-compose, which already passed all three parameters.

Checklist

Before submitting this PR, please make sure that:

Issues related (if applicable)

Related to environment variable substitution in Stack compose type applications.

Screenshots (if applicable)

N/A - Backend logic change with test coverage added.

Original prompt

This section details on the original issue you should resolve

<issue_title>Unable to use envs of environment on Stack compose type application</issue_title>
<issue_description>### To Reproduce

  1. Configure envs of environment

    FOO=bar
  2. Create Compose application with Stack type

  3. Configure service envs which uses env from environment

    FOO=${{environment.FOO}}
  4. Deploy application

Current vs. Expected behavior

Current behaviour: error Invalid environment variable: environment.FOO

Expected behaviour: Envs being injected

Provide environment information

Operating System:
  OS: WSL2
  Arch: amd64

Dokploy version: v0.26.4

Which area(s) are affected? (Select all that apply)

Application, Docker Compose

Are you deploying the applications where Dokploy is installed or on a remote server?

Same server where Dokploy is installed

Additional context

This error only occurs when using the Stack type. The error does not occur when using the Docker Compose type.

The issue does not occur when using project envs.

Will you send a PR to fix it?

Maybe, need help</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 15, 2026 15:39
Co-authored-by: Siumauricio <47042324+Siumauricio@users.noreply.github.com>
Co-authored-by: Siumauricio <47042324+Siumauricio@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix unable to use envs of environment on Stack compose type application Fix environment variable resolution for Stack compose deployments Jan 15, 2026
Copilot AI requested a review from Siumauricio January 15, 2026 15:46
@Siumauricio Siumauricio marked this pull request as ready for review January 16, 2026 07:08
@Siumauricio Siumauricio merged commit 2760c16 into canary Jan 16, 2026
4 checks passed
@Siumauricio Siumauricio deleted the copilot/fix-envs-in-stack-compose branch January 16, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to use envs of environment on Stack compose type application

2 participants