cloudflare / wrangler-action

🧙‍♀️ easily deploy cloudflare workers applications using wrangler and github actions
Apache License 2.0
1.26k stars 159 forks source link

Stop racing secret uploads #255

Closed matthewdavidrodgers closed 6 months ago

matthewdavidrodgers commented 7 months ago

For up to date versions of wrangler, secrets are uploaded via the 'secret:bulk' command, which batches updates in a single API call.

For versions of wrangler without that capability, the action falls back to the single 'secret put' command for each secret. It races all these with a Promise.all()

Unfortunately, the single secret API cannot handle concurrency - at best, these calls have to wait on one another, holding requests open all the while. Often it times out and errors.

This fixes the legacy secret upload errors by making these calls serially instead of concurrently.

RamIdeas commented 6 months ago

I think this change makes sense. If you're on a legacy version of wrangler, pre-secret:bulk, you'll get a slower but more stable experience. You'll need to upgrade to newer versions of wrangler, post-secret:bulk, to get the faster bulk upload.

Tests were run in #256, since this PR came from a fork.