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

🐛 BUG: wrangler secret put has breaking change with versions #6763

Closed
huv1k opened this issue Sep 19, 2024 · 6 comments
Closed

🐛 BUG: wrangler secret put has breaking change with versions #6763

huv1k opened this issue Sep 19, 2024 · 6 comments
Labels
bug Something that isn't working

Comments

@huv1k
Copy link

huv1k commented Sep 19, 2024

Which Cloudflare product(s) does this pertain to?

Wrangler

What version(s) of the tool(s) are you using?

3.78.5

What version of Node are you using?

v20.16.0

What operating system and version are you using?

macOS 14.6.1 + Ubuntu Jammy (22.04.5 LTS)

Describe the Bug

Observed behavior

We have our CI/CD pipeline, where we deploy workers like wrangler deploy --env production --outdir dist and later on in different steps we set secrets with current commit sha git rev-parse HEAD 2>&1 | wrangler secret put COMMIT_SHA --env production this was working fine. We are not always deploying secrets and workers at the same time. We modify secrets more often than we deploy workers. But we started seeing an error:

Secret edit failed. You attempted to modify a secret, but the latest version of your Worker isn't currently deployed. Please ensure that the latest version of your Worker is fully deployed (wrangler versions deploy) before modifying secrets. Alternatively, you can use the Cloudflare dashboard to modify secrets and deploy the version.
  
Note: This limitation will be addressed in an upcoming release.

This is breaking change without any notification and which upcoming release will fix it? There is no information whatsoever. Why is there not used compatibility_date inside wrangler.toml to handle such a change?

Expected behavior

I would expect this behavior would work as before, without changing compatibility_date, otherwise it should be properly documented and provide the exact date when the "upcoming" release is going to fix it. Another option is to provide a link to an explanation or provide at least "some" documentation. This is a poorly executed breaking change.

Steps to reproduce

Please provide the following:

  1. Deploy worker using wrangler deploy
  2. Update secret using wrangler secret put

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

@huv1k huv1k added the bug Something that isn't working label Sep 19, 2024
@IgorMinar
Copy link
Contributor

This is a bummer.. sorry about that.

I took a quick look and this seems to have been introduced in #5930 by @WalshyDev and approved by @tanushree-sharma on the PM side.

@tanushree-sharma can you please help address this via a follow up and also help clarify when the "upcoming release" is coming? Thanks a bunch!

@tanushree-sharma
Copy link

👋🏼 @huv1k. Sorry you're running into this.

Are you using the wrangler versions commands to upload/deploy Workers? It doesn't sound like you are but want to confirm.

@huv1k
Copy link
Author

huv1k commented Sep 19, 2024

No we are using just deploy

@tanushree-sharma
Copy link

tanushree-sharma commented Sep 20, 2024

@huv1k We've been digging into this and believe you're seeing this as a result of concurrent operations that come from wrangler deploy and wrangler secret put. Running these operations close together triggers a race condition.

We're going to work to make these operations faster to minimize chances of running into this. In the meantime when you update both your Worker and it's secrets try:

  • Using the secret bulk command (when updating multiple secrets)
  • and updating your secret first wrangler secret put and then doing a wrangler deploy

Using these should minimize when the race condition is triggered.

@jiri-prokop-pb
Copy link

@tanushree-sharma We tried to follow your suggestion, together with additional instruction we got from the support that is about adding a slight delay of a few seconds but we still see that error.

When I flipped wrangler secret put and wranger deploy then it works. Do you see any harm doing the two commands in the reversed order (deploy then secret put) with a delay of several seconds or minutes between them? Or is your suggested order important?

@tanushree-sharma
Copy link

tanushree-sharma commented Sep 30, 2024

I don't see harm, as long as you're okay with applying the secret after wrangler deploy. Going to close this out since this issue is resolved.

@tanushree-sharma tanushree-sharma closed this as not planned Won't fix, can't repro, duplicate, stale Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working
Projects
None yet
Development

No branches or pull requests

4 participants