workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

🐛 BUG: publish fails when attempting to publish a Worker to routes that already exist

Open jsvsco opened this issue 3 years ago • 4 comments

What version of Wrangler are you using?

2.1.3

What operating system are you using?

Mac

Describe the Bug

When attempting to publish a Worker to a custom domain on routes that already exist on a different worker on the same domain the publish fails with:

✘ [ERROR] A request to the Cloudflare API (/accounts//workers/scripts//routes) failed.

workers.api.error.unknown [code: 10013]

I can understand that there may be no one right answer to resolve this issue, but the error message could be improved and could include steps for resolution of common scenarios, e.g: manually remove the routes in the dashboard (or via API I suppose) that are needed for the publish to succeed.

jsvsco avatar Sep 13 '22 21:09 jsvsco

Hey @jsvsco - any chance you could send over a minimal reproduction of this?

rozenmd avatar Sep 15 '22 14:09 rozenmd

  1. Create a new worker in the Cloudflare Workers dashboard.
  2. Assign it a route on a custom domain.
  3. Initialize a new worker locally in Wrangler with a different name from the worker in (1).
  4. Add the same route as (2) to its wrangler.toml.
  5. Attempt to publish the worker with Wrangler and you should receive the error above.

jsvsco avatar Sep 17 '22 11:09 jsvsco

Ah custom domains get dealt with separately than other routes. So perhaps we need to implement something similar to https://github.com/cloudflare/wrangler2/commit/b44cc26546e4b625870ba88b292da548b6a340c0#diff-d79823fe1e90cdc27158bbeaab5f58954e81375f84f4403ca124318c7bccd54fR673-R686 for custom domains.

petebacondarwin avatar Sep 17 '22 12:09 petebacondarwin

I didn't think about it, but it makes sense that custom domain is important. I updated the original report.

jsvsco avatar Sep 17 '22 13:09 jsvsco