Strange behavior, several bugs when re-deploying

Hi all,

Is there a proper way to “un-deploy” a worker rather than deleting it (i.e., wrangler delete)?

I’ve been taking down my worker by deleting it, but I’m running into several issues around secrets and false deployments when I want to deploy the worker again.

Here’s an example reproduction:

Reproduction

wrangler delete
wrangler secret:bulk secrets.json # ✘ [ERROR] 🚨 1 secrets failed to upload
yarn wrangler secret list # shows the secrets actually there
wrangler secret:bulk secrets.json # ✨ 1 secrets successfully uploaded
wrangler deployments list

The output of the final wrangler deployments list shows:

Deployment ID: (redacted)
Created on:    2023-11-16T20:05:07.411569Z
Author:        (redacted)
Source:        Upload from Wrangler 🤠

Deployment ID: (redacted)
Created on:    2023-11-16T20:05:08.648391Z
Author:        (redacted)
Source:        Secret Change from Wrangler 🤠

Deployment ID: (redacted)
Created on:    2023-11-16T20:05:30.410174Z
Author:        (redacted)
Source:        Secret Change from Wrangler 🤠
🟩 Active

Trying with multiple (n) secrets, I see that I get n Upload from Wrangler 🤠s followed by n Secret Change from Wrangler 🤠s.

However, when I visit my deployment (at https://[app].[uname].workers.dev/), I get the “There is nothing here yet” page.

In other words, uploading secrets:

  • says it fails, but it doesn’t
  • automatically deploys my app (several times)
  • … but doesn’t actually deploy my app (it’s not running)
  • makes wrangler confused about whether my app is deployed

There are several surprising things here, so let me try to summarize with a table:

Step Expected Actual
Take down a deployment without deleting the deployment history wrangler undeploy or
wrangler down or
wrangler unpublish
(none)
If wrangler secrets:bulk [file] shows ✘ [ERROR] 🚨 N secrets failed to upload, have the secrets actually been uploaded? no yes
Does wrangler secrets:bulk [file] cause n Upload from Wrangler 🤠s for n secrets? no yes
Does wrangler secrets:bulk [file] show no error message on the first try with no deployment? yes no
if wrangler deployments list shows :green_square: Active, is the deployment active? yes no

Apologies in advance if I’m super confused here and doing something wrong. Anyone else have experience taking workers down and up more gracefully than I’m achieving?

Thank you!
Max

P.S. I opened a GitHub issue (https://github.com/cloudflare/workers-sdk/issues/4459) describing this as well, but I figured it could be a good candidate for a community question as well.

If you want to unpublish a worker, then you just need to remove the routes and any other handlers that you have.

My guess for the deployment is based on how the dashboard displays the information that it gets from the API rather than how wrangler does it.

1 Like