workers-sdk: ๐Ÿ› BUG: MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start.

Which Cloudflare product(s) does this pertain to?

Pages, Workers Runtime, Wrangler core, Miniflare

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

wrangler 3.22.3, miniflare version 3.20231218.1, workerd 1.20231218.0

What version of Node are you using?

v16.17.1

What operating system are you using?

Debian 12.4 (latest stable)

Describe the Bug

Hey Iโ€™m a junior developer (or maybe lower) and I followed https://developers.cloudflare.com/pages/framework-guides/deploy-a-react-site/ to deploy a static React site to cloudflare pages. It worked brilliantly, and I was starting on the development (which, as a newbie, means enthusiastically testing out code that doesnโ€™t work).

Suddenly I started getting these errors when through up a development site.

I tried removing bits of code that might have caused it that Iโ€™d recently changed, and I donโ€™t think thatโ€™s it.

At first glance, the error log reads like โ€œoh, you already have something running on that portโ€ but if you look at the examples in error between those - you see whatโ€™s happening:

  1. The dev site starts
  2. Wrangler tries to do some magic to bring the workers in.
  3. This fails, but the dev site continues
  4. when the dev site is terminated - we see this repeat
  5. and whilst the dev site is still running, we see it fail before this point.

I did a bit of digging into the locations of the error messages.

/home/tdobson/Videos/dev/save-old-glossop/node_modules/wrangler/wrangler-dist/cli.js:29374
            throw a;
            ^

When I look at that file, it literally just says

          process.argv.slice(2);
          process.on("uncaughtException", function(a) {
            throw a;
          });
          process.on(
            "unhandledRejection",
            function(a) {
              throw a;
            }
          );

In miniflare/dist/src/index.js, I tried adding a couple of console logs - and to me, that didnโ€™t add much useful, but maybe it did to you.


    if (this.#disposeController.signal.aborted)
      return;
    console.error(maybeSocketPorts)
    console.error(configBuffer)
    console.error(runtimeOpts)

    if (maybeSocketPorts === void 0) {
      throw new MiniflareCoreError(
        "ERR_RUNTIME_FAILURE",
        "The Workers runtime failed to start. There is likely additional logging output above."
      );
    }

The project compiles and deploys to Cloudflare Pages just nicely.

From my point of view, itโ€™s frustrating because I donโ€™t care about serverside functions. Itโ€™d be a neat feature for the future, but I need to suck less at React before I want to play with that. If thereโ€™s an obvious option I can use to disable it, Iโ€™d be hyped - this is my first project with Cloudflare Pages and I was enjoying it til this point.

I wonder if this is linked to this other bug report. I suspect not, but if it is - feel free to merge etc

Thanks for taking a look at this. Happy to provide other info etc.

If you want me to test something for you - Iโ€™d be happy to, and if you could dumb things down/give me the commands to run - Iโ€™d really appreciate it.

Please provide a link to a minimal reproduction

https://github.com/tdobson/cloudflare-wrangler-setup-problem-example

Please provide any relevant error logs


tdobson@tragicomix:~/Videos/dev/save-old-glossop$  wrangler pages dev --compatibility-date=2023-12-18 --port 3000 --log-level=debug -- npm start 
Running npm start...
Sleeping 5 seconds to allow proxy process to start before attempting to automatically determine port...
To skip, specify the proxy port with --proxy.
[proxy]: 
> save-old-glossop@0.1.0 start
> react-scripts start


โœ˜ [ERROR] [proxy]: (node:56144) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.

  (Use `node --trace-deprecation ...` to show where the warning was created)
  


โœ˜ [ERROR] [proxy]: (node:56144) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.

  


[proxy]: Starting the development server...


[proxy]: Compiled successfully!

[proxy]: 
You can now view save-old-glossop in the browser.

  Local:            http://localhost:3000
  On Your Network:  http://192.168.86.52:3000

Note that the development build is not optimized.

[proxy]: To create a production build, use npm run build.


[proxy]: webpack compiled successfully

Automatically determined the proxy port to be 3000.
No functions. Shimming...
 โ›…๏ธ wrangler 3.22.3
-------------------
โ–ฒ [WARNING] --local is no longer required and will be removed in a future version.

  `wrangler dev` now uses the local Cloudflare Workers runtime by default. ๐ŸŽ‰


Retrieving cached values for userId from node_modules/.cache/wrangler
Metrics dispatcher: Dispatching disabled - would have sent {"type":"event","name":"run dev","properties":{"local":true,"usesTypeScript":true}}.
Using vars defined in .dev.vars
โŽ” Starting local server...
Not Implemented Error: BundlerController#onConfigUpdate
ProxyWorker miniflare options changed, reinstantiating...
Error in ProxyController: Could not connect to InspectorProxyWorker
 MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
    at Miniflare.#assembleAndUpdateConfig (/usr/local/lib/node_modules/wrangler/node_modules/miniflare/dist/src/index.js:8902:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Mutex.runWith (/usr/local/lib/node_modules/wrangler/node_modules/miniflare/dist/src/index.js:3863:16) {
  code: 'ERR_RUNTIME_FAILURE',
  cause: undefined
}
=> Error contextual data: {
  config: {
    name: 'worker',
    script: { contents: '' },
    dev: {
      server: [Object],
      inspector: [Object],
      urlOverrides: [Object],
      liveReload: false
    }
  },
  bundle: undefined
}
Error in ProxyController: Failed to send message to InspectorProxyWorker: {"type":"reloadStart"}
 MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
    at Miniflare.#assembleAndUpdateConfig (/usr/local/lib/node_modules/wrangler/node_modules/miniflare/dist/src/index.js:8902:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Mutex.runWith (/usr/local/lib/node_modules/wrangler/node_modules/miniflare/dist/src/index.js:3863:16) {
  code: 'ERR_RUNTIME_FAILURE',
  cause: undefined
}
=> Error contextual data: {
  config: {
    name: 'worker',
    script: { contents: '' },
    dev: {
      server: [Object],
      inspector: [Object],
      urlOverrides: [Object],
      liveReload: false
    }
  },
  bundle: undefined
}
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ [b] open a browser, [d] open Devtools, [c] clear console, [x] to exit                                                                                                                                                                โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
/usr/local/lib/node_modules/wrangler/wrangler-dist/cli.js:29374
            throw a;
            ^

MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
    at Miniflare.#assembleAndUpdateConfig (/usr/local/lib/node_modules/wrangler/node_modules/miniflare/dist/src/index.js:8902:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Mutex.runWith (/usr/local/lib/node_modules/wrangler/node_modules/miniflare/dist/src/index.js:3863:16) {
  code: 'ERR_RUNTIME_FAILURE',
  cause: undefined
}

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Reactions: 4
  • Comments: 15 (5 by maintainers)

Most upvoted comments

I resolved the issue by disabling my IPv6 localhost in my /etc/hosts files. Like,

127.0.0.1       localhost
#fe80::1         localhost

same for node 20, bare โ€œhello-worldโ€ worker created by C3 cli.