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

Netlify env branch/context needs to be case sensitive #6494

Open
zbobbert opened this issue Apr 4, 2024 · 1 comment
Open

Netlify env branch/context needs to be case sensitive #6494

zbobbert opened this issue Apr 4, 2024 · 1 comment
Labels
type: bug code to address defects in shipped code

Comments

@zbobbert
Copy link

zbobbert commented Apr 4, 2024

Describe the bug

When setting (or unsetting) Netlify branch environment variables using the CLI, the --context parameter seems to be converted to lowercase, resulting in the environment variables being associated with the wrong branch name.

Steps to reproduce

Run netlify env:set test_env_var test_value --context "Case-Sensitive"
I expect the resulting variable to be created under the "Case-Sensitive" branch, but instead it is created under the "case-sensitive" branch.

Configuration

[build]
command = "npm run build"
publish = ".next"

[[plugins]]
package = "netlify-plugin-cypress"

Environment

System:
OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
CPU: (16) x64 AMD Ryzen 7 7800X3D 8-Core Processor
Memory: 3.14 GB / 30.49 GB
Container: Yes
Shell: 5.8.1 - /usr/bin/zsh
Binaries:
Node: 20.11.1 - ~/.volta/tools/image/node/20.11.1/bin/node
Yarn: 1.22.10 - ~/.volta/bin/yarn
npm: 10.2.4 - ~/.volta/tools/image/node/20.11.1/bin/npm

netlify --version
netlify-cli/17.21.1 linux-x64 node-v20.11.1

@zbobbert zbobbert added the type: bug code to address defects in shipped code label Apr 4, 2024
@zbobbert
Copy link
Author

zbobbert commented Apr 5, 2024

Here's my workaround using the Netlify API:

SET_ENV_DATA=$(jq -n \
  --arg account_id "$NETLIFY_ACCOUNT_ID" \
  --arg site_id "$NETLIFY_SITE_ID" \
  --arg context_parameter "$BRANCH_NAME" \
  --arg key "test_env_var" \
  --arg value "test_value" \
  '{ $account_id, $key, $site_id, body: { context: "branch", $context_parameter, $value } }')
UPDATED_ENV_DATA=$(netlify api setEnvVarValue --data "${SET_ENV_DATA}")```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

1 participant