Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing variables that depend on other variables from file changes starting from version 19.3 #27060

Open
1 of 4 tasks
summis opened this issue Jul 23, 2024 · 2 comments
Open
1 of 4 tasks
Assignees

Comments

@summis
Copy link

summis commented Jul 23, 2024

Current Behavior

If .env file contains

FOO="foo"
FOOBAR="$FOO-bar"

nx reads these as $FOO => foo and $FOOBAR => foo, omitting -bar suffix from the latter

Expected Behavior

It should read suffix correctly so that $FOO => foo and $FOOBAR => foo-bar

GitHub Repo

https://github.com/summis/nx-bug-demo

Steps to Reproduce

See https://github.com/summis/nx-bug-demo/blob/main/README.md

Nx Report

npx nx report

 NX   Report complete - copy this into the issue template

Node   : 22.4.1
OS     : linux-x64
npm    : 10.8.2

nx         : 19.3.2
@nrwl/tao  : 19.3.2

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

This seems to have something to do with the dash character (-) after the variable. Other character don't have same issue in my limited testing.

@FrozenPandaz FrozenPandaz added the scope: core core nx functionality label Jul 24, 2024
@MaxKless
Copy link
Collaborator

Hey @summis! Thanks for the report here and the exceptionally simple repro. It really let me track this down very quickly.

The root issue of this is motdotla/dotenv-expand#124 which was introduced when we updated dotenv-expand in #26459.

Until the upstream issue is resolved, you can slightly modify your env variables to go back to the old behaviour. In your example, using

FOO="foo"
FOOBAR="${FOO}-bar"

will return the correct foo foo-bar output once again.

Hope that helps and thanks again for the great-to-work-with issue.

@summis
Copy link
Author

summis commented Jul 29, 2024

Thank you @MaxKless for the rapid investigation and workaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants