Cannot delete Worker and Durable Object

I’m having a very similar problem to Cannot delete workers with durable object bindings, which was reported in November.

I went through the sample project to learn about Durable Objects. I published it with wrangler publish, and all went well.

Now I want to delete it but I can’t because there is a circular reference between the Worker and the Durable Object.

Deleting the Durable Object as a migration in wrangler.toml is not a good solution because that requires changing the project. I want to remove the running service, not remove the durable object from the code.

Error when I try to delete the Worker in the dashboard:

Error when I try to delete the Durable Object in the dashboard:

I found a workaround. This removes the circular reference between the Worker and the Durable Object so you can unpublish them both without changing your source code:

  1. In the dashboard, go to the worker, then Settings, then Variables.
  2. Click Edit Variables. Delete the variable associated with the Durable Object.
  3. Now go to the worker, Resources, scroll down to Durable Objects.
  4. Click the Durable Object, then Settings, then Delete.
  5. Now go to the worker, then Manage Service (top right). Click Delete Service.
2 Likes