-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
vercel
cli has not option to update existing values
#11130
Comments
While not ideal, you could remove the env variable |
We've programmed some commands for that, but its not ideal and introduces more room for errors and intermediate states if something fails. A simple update flag would be the best way to handle it for our case. |
I also have the same problem... it would be great is there was a |
I started looking into raising a PR to add this functionality and found that the Vercel API endpoint for There is also (for interest) another endpoint for "editing" an existing env var when it exists, but you need to know it's ID, not the envvar name/key (so you need to do a map first. So it shouldn't be too much extra to change this in Vercel CLI. |
What's interesting/strange/confusing is that when you attempt to
Yet, I can't find this error message in the CLI codebase (this project), I thought maybe the API is returning this error, yet trying to create a new envar Key that already exists returns the following error from the API (https://api.vercel.com/v10/projects/${projectID}/env): {
"error": {
"code": "ENV_CONFLICT",
"message": "A variable with the name `API_URL` and target `preview` already exists",
"key": "key",
"envVarKey": "API_URL"
},
"failed": [
{
"error": {
"code": "ENV_CONFLICT",
"message": "A variable with the name `API_URL` and target `preview` already exists",
"key": "key",
"envVarKey": "API_URL"
}
}
]
} I'll keep digging to see where the CLI's error is coming from (could be using an older endpoint)... UpdateEndpoint v9 is returning the error below when trying to set an existing env Key. v9 also doesn't allow the "upsert" para... so CLI will need updating to use v10 of this endpoint. {
"error": {
"code": "ENV_ALREADY_EXISTS",
"message": "Another Environment Variable with the same Name and Environment exists in your project. Remove it or choose a different Name or Environment.",
"key": "API_URL",
"configurationId": null,
"target": [
"preview"
]
}
} Update 2CLI is using v8: |
## Why Closes #11130 ## Changelog Added `--force` argument to upsert existing environment variables (#11130) ## References - Vercel API `/v10/projects/{idOrName}/env` https://vercel.com/docs/rest-api/endpoints/projects#create-one-or-more-environment-variables
Awesome work! |
## Why Closes #11130 ## Changelog Added `--force` argument to upsert existing environment variables (#11130) ## References - Vercel API `/v10/projects/{idOrName}/env` https://vercel.com/docs/rest-api/endpoints/projects#create-one-or-more-environment-variables
Hello. We use the vercel cli in our CICD platform and we've noticed that using
vercel env add
command will fail one existing secrets. It would be ideal if the CLI had an--update
flag to make the vercel CLI overwrite the existing env secret rather than failing with an error. This will ensure we set the most recent secrets and not keeping around any old values.The text was updated successfully, but these errors were encountered: