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

🐛 BUG: Failed to register worker in local service registry TypeError: fetch failed

Open ajay0180 opened this issue 1 year ago • 1 comments

I can run the worker no problem from the browser at localhost:8787, but not the tests.### Which Cloudflare product(s) does this pertain to?

Workers Runtime

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

3.80.4

What version of Node are you using?

20.14.0

What operating system and version are you using?

MacOS sonoma

Describe the Bug

Observed behavior

Please describe.

Expected behavior

Please describe.

Steps to reproduce

Please provide the following:

  • A minimal working subset of your worker code
  • A minimal working subset of your wrangler.toml
  • Commands used to start your local dev server, including custom env and cli args
  • Steps to be performed in the browser, curl commands, or a test we can run that reliably fails (at least a percent of the time)

A git repo we can clone and run a test suite on, or which has a README with step-by-step instructions, is even better. In this case, please use the field below to provide a link to the minimal repro.

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

I can run the worker no problem from the browser at localhost:8787, but not the tests.

ajay0180 avatar Oct 12 '24 12:10 ajay0180

me too

hato-maasaa avatar Oct 13 '24 03:10 hato-maasaa

Could you try the file based registry? i.e. wrangler dev --x-registry

penalosa avatar Oct 24 '24 08:10 penalosa

We haven't heard from you in while so I'm going to close this issue for now. If you're still running into problems feel free to open a new issue with more details and we can investigate further.

penalosa avatar Nov 08 '24 20:11 penalosa

@penalosa I'm hitting this issue with 3.87.0:

 ⛅️ wrangler 3.87.0
-------------------

⎔ Starting local server...
[wrangler:inf] Ready on http://localhost:8787
[wrangler:inf] GET / 200 OK (9ms)
▲ [WARNING] Failed to get worker definitions TypeError: fetch failed

      at fetch
  (/Users/vberchet/Library/Caches/pnpm/dlx/urbdfi62nsblbmep3m42jqmnca/19344d5ed5d-17f97/node_modules/.pnpm/[email protected]/node_modules/wrangler/wrangler-dist/cli.js:17232:19)
      at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
      at async getRegisteredWorkers
  (/Users/vberchet/Library/Caches/pnpm/dlx/urbdfi62nsblbmep3m42jqmnca/19344d5ed5d-17f97/node_modules/.pnpm/[email protected]/node_modules/wrangler/wrangler-dist/cli.js:132076:22)
      at async Timeout._onTimeout
  (/Users/vberchet/Library/Caches/pnpm/dlx/urbdfi62nsblbmep3m42jqmnca/19344d5ed5d-17f97/node_modules/.pnpm/[email protected]/node_modules/wrangler/wrangler-dist/cli.js:132040:24)
  {
    cause: ConnectTimeoutError: Connect Timeout Error
        at onConnectTimeout
  (/Users/vberchet/Library/Caches/pnpm/dlx/urbdfi62nsblbmep3m42jqmnca/19344d5ed5d-17f97/node_modules/.pnpm/[email protected]/node_modules/wrangler/wrangler-dist/cli.js:6054:29)
        at
  /Users/vberchet/Library/Caches/pnpm/dlx/urbdfi62nsblbmep3m42jqmnca/19344d5ed5d-17f97/node_modules/.pnpm/[email protected]/node_modules/wrangler/wrangler-dist/cli.js:6010:51
        at Immediate._onImmediate
  (/Users/vberchet/Library/Caches/pnpm/dlx/urbdfi62nsblbmep3m42jqmnca/19344d5ed5d-17f97/node_modules/.pnpm/[email protected]/node_modules/wrangler/wrangler-dist/cli.js:6042:13)
        at process.processImmediate (node:internal/timers:491:21)
        at process.topLevelDomainCallback (node:domain:161:15)
        at process.callbackTrampoline (node:internal/async_hooks:128:24) {
      code: 'UND_ERR_CONNECT_TIMEOUT'
    }
  }

I'm running a simple c3 hello world worker.

Using wrangler dev --x-registry seems to fix the issue

vicb avatar Nov 19 '24 14:11 vicb

@vicb We'll be defaulting --x-registry to true in the next version of Wrangler (https://github.com/cloudflare/workers-sdk/pull/7261), which will be released later today

penalosa avatar Nov 19 '24 14:11 penalosa