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

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

Open tdobson opened this issue 2 years ago โ€ข 13 comments

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]: 
> [email protected] 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
}

tdobson avatar Jan 05 '24 21:01 tdobson

Just tried updating my node environment to Node.js v18.19.0. The issue persists.

Mercifully, I have learned that npm start will do "just fine" for me, so I'm now able to continue my dev. yay.


tdobson@tragicomix:~/Videos/dev/save-old-glossop-not-working$ npm run
Lifecycle scripts included in [email protected]:
  start
    react-scripts start
  test
    react-scripts test

available via `npm run-script`:
  build
    react-scripts build
  eject
    react-scripts eject
  pages:dev
    wrangler pages dev --compatibility-date=2023-12-18 --port 3000 -- npm start
  pages:deploy
    npm run build && wrangler pages deploy ./build

tdobson@tragicomix:~/Videos/dev/save-old-glossop-not-working$ npm run pages:dev

> [email protected] pages:dev
> wrangler pages dev --compatibility-date=2023-12-18 --port 3000 -- 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]: 
> [email protected] start
> react-scripts start


โœ˜ [ERROR] [proxy]: (node:99096) [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:99096) [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.1.65:3000

[proxy]: 
Note that the development build is not optimized.
To create a production build, use npm run build.


Automatically determined the proxy port to be 3000.
No functions. Shimming...
[proxy]: webpack compiled successfully

 โ›…๏ธ 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. ๐ŸŽ‰


Using vars defined in .dev.vars
โŽ” Starting local server...
undefined
<Buffer 00 00 00 00 ae 5c 00 00 00 00 00 00 00 00 04 00 0d 00 00 00 df 00 00 00 a5 81 00 00 67 00 00 00 00 00 00 00 00 00 00 00 3d 82 00 00 0f 00 00 00 24 00 ... 189766 more bytes>
{
  signal: AbortSignal { aborted: false },
  entryAddress: 'localhost:3000',
  loopbackPort: 40761,
  requiredSockets: [ 'entry', 'direct:1' ],
  inspectorAddress: undefined,
  verbose: false,
  handleRuntimeStdio: [Function (anonymous)]
}
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ [b] open a browser, [d] open Devtools, [c] clear console, [x] to exit                                                                                               โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
/home/tdobson/Videos/dev/save-old-glossop-not-working/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 #assembleAndUpdateConfig (/home/tdobson/Videos/dev/save-old-glossop-not-working/node_modules/miniflare/dist/src/index.js:8906:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Mutex.runWith (/home/tdobson/Videos/dev/save-old-glossop-not-working/node_modules/miniflare/dist/src/index.js:3863:16) {
  code: 'ERR_RUNTIME_FAILURE',
  cause: undefined
}

Node.js v18.19.0

tdobson avatar Jan 06 '24 05:01 tdobson

same for node 20, bare "hello-world" worker created by C3 cli.

a5r0n avatar Jan 07 '24 12:01 a5r0n

if you are using a mac, it likely has to do with folder permissions, make sure you give yourself full rights: chown R user folder etc. That worked for me.

mchennupati avatar Jan 22 '24 14:01 mchennupati

Works for me if i first kill any proccess on port 3000 fuser -k 3000/tcp

and then run npx wrangler pages dev --compatibility-date=2023-12-18 -- npm start Note that i have removed --port 3000

Using WSL node: v16.20.2 wrangler: 3.25.0

AnderScore avatar Jan 28 '24 21:01 AnderScore

@tdobson can you please re-run this command with WRANGLER_LOG=debug, or if you're running this on the latest version of wrangler, these logs should already be written to a file logged at the end of your session.

can you please then provide these debug logs so we can investigate? thanks!

lrapoport-cf avatar Feb 05 '24 15:02 lrapoport-cf

I'm not @tdobson but I was running into the same thing w/ node 20.10.0 and Wrangler 3.26.0, here are my debug logs:

logs

--- 2024-02-05T20:23:11.291Z debug
๐Ÿชต  Writing logs to "/Users/roryabraham/Library/Preferences/.wrangler/logs/wrangler-2024-02-05_20-23-11_224.log"
---

--- 2024-02-05T20:23:11.291Z debug
Failed to load .env file ".env": Error: ENOENT: no such file or directory, open '.env'
    at Object.openSync (node:fs:581:18)
    at Object.readFileSync (node:fs:457:35)
    at tryLoadDotEnv (/Users/roryabraham/Expensidev/Cloudflare-Workers/node_modules/wrangler/wrangler-dist/cli.js:124257:72)
    at loadDotEnv (/Users/roryabraham/Expensidev/Cloudflare-Workers/node_modules/wrangler/wrangler-dist/cli.js:124266:12)
    at /Users/roryabraham/Expensidev/Cloudflare-Workers/node_modules/wrangler/wrangler-dist/cli.js:162342:20
    at /Users/roryabraham/Expensidev/Cloudflare-Workers/node_modules/wrangler/wrangler-dist/cli.js:131131:16
    at maybeAsyncResult (/Users/roryabraham/Expensidev/Cloudflare-Workers/node_modules/wrangler/wrangler-dist/cli.js:129352:44)
    at /Users/roryabraham/Expensidev/Cloudflare-Workers/node_modules/wrangler/wrangler-dist/cli.js:131130:14
    at /Users/roryabraham/Expensidev/Cloudflare-Workers/node_modules/wrangler/wrangler-dist/cli.js:129339:22
    at Array.reduce (<anonymous>) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '.env'
}
---

--- 2024-02-05T20:23:11.297Z log
 โ›…๏ธ wrangler 3.26.0
[38;5;214m-------------------[39m
---

--- 2024-02-05T20:23:11.315Z debug
Metrics dispatcher: Posting data {"type":"event","name":"run dev","properties":{"local":true,"usesTypeScript":false}}
---

--- 2024-02-05T20:23:11.319Z log
Using vars defined in .dev.vars
---

--- 2024-02-05T20:23:11.319Z log
Your worker has access to the following bindings:
- Vars:
  - CSP_DEFAULT_SRC: "(hidden)"
  - CSP_SCRIPT_SRC: "(hidden)"
  - CSP_CONNECT_SRC: "(hidden)"
  - blob: "(hidden)"
  - CSP_IMG_SRC: "(hidden)"
  - data: "(hidden)"
  - CSP_STYLE_SRC: "(hidden)"
  - CSP_FONT_SRC: "(hidden)"
  - CSP_FRAME_SRC: "(hidden)"
  - CSP_WORKER_SRC: "(hidden)"
  - CSP_CHILD_SRC: "(hidden)"
  - CSP_MEDIA_SRC: "(hidden)"
  - CSP_FRAME_ANCESTORS: "(hidden)"
---

--- 2024-02-05T20:23:11.363Z log
[2mโŽ” Starting local server...[22m
---

--- 2024-02-05T20:23:11.398Z debug
workerd/util/symbolizer.c++:96: warning: Not symbolizing stack traces because $LLVM_SYMBOLIZER is not set. To symbolize stack traces, set $LLVM_SYMBOLIZER to the location of the llvm-symbolizer binary. When running tests under bazel, use `--test_env=LLVM_SYMBOLIZER=<path>`.
*** Fatal uncaught kj::Exception: kj/compat/tls.c++:72: failed: OpenSSL error; message = error:0900006e:PEM routines:OPENSSL_internal:NO_START_LINE
stack: 102e1b53b 102e1d2c3 1020e45a3 1020e66c3 1020eddeb 1020f15b3 1020eff03 1020dd147 1020e176b 1020e1653 1020e163b 1041ab883 1041abbcb 1041aa32b 1041aa0fb 1020d41af 18d6690df
---

Interesting โ€“ seems to be an SSL error?

roryabraham avatar Feb 05 '24 20:02 roryabraham

same here with miniflare README example code

maybe related to https://github.com/cloudflare/workerd/issues/2589?

import { Miniflare } from "miniflare";

// Create a new Miniflare instance, starting a workerd server
const mf = new Miniflare({
	script: `addEventListener("fetch", (event) => {
    event.respondWith(new Response("Hello Miniflare!"));
  })`,
});

// Send a request to the workerd server, the host is ignored
const response = await mf.dispatchFetch("http://localhost:8787/");
console.log(await response.text()); // Hello Miniflare!

// Cleanup Miniflare, shutting down the workerd server
await mf.dispose();
zsh โฏ cat package.json
{
  "name": "little-tooth-5b50",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "deploy": "wrangler deploy",
    "dev": "wrangler dev",
    "start": "wrangler dev"
  },
  "devDependencies": {
    "wrangler": "^3.0.0"
  }
}%

zsh โฏ cat test.mjs
import { Miniflare } from 'miniflare';

// Create a new Miniflare instance, starting a workerd server
const mf = new Miniflare({
        script: `addEventListener("fetch", (event) => {
    event.respondWith(new Response("Hello Miniflare!"));
  })`,
});

// Send a request to the workerd server, the host is ignored
const response = await mf.dispatchFetch('http://localhost:8787/');
console.log(await response.text()); // Hello Miniflare!

// Cleanup Miniflare, shutting down the workerd server
await mf.dispose();

zsh โฏ node --version
v21.5.0

zsh โฏ node test.mjs
workerd/util/symbolizer.c++:96: warning: Not symbolizing stack traces because $LLVM_SYMBOLIZER is not set. To symbolize stack traces, set $LLVM_SYMBOLIZER to the location of the llvm-symbolizer binary. When running tests under bazel, use `--test_env=LLVM_SYMBOLIZER=<path>`.
*** Fatal uncaught kj::Exception: kj/compat/tls.c++:72: failed: OpenSSL error; message = error:0900006e:PEM routines:OPENSSL_internal:NO_START_LINE
stack: 104e9353b 104e952c3 10415c5a3 10415e6c3 104165deb 1041695b3 104167f03 104155147 10415976b 104159653 10415963b 106223883 106223bcb 10622232b 1062220fb 10414c1af 182fd50df
/Users/yqrashawn/workspace/home/little-tooth-5b50/node_modules/miniflare/dist/src/index.js:8480
      throw new MiniflareCoreError(
            ^

MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
    at #assembleAndUpdateConfig (/Users/yqrashawn/workspace/home/little-tooth-5b50/node_modules/miniflare/dist/src/index.js:8480:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Mutex.runWith (/Users/yqrashawn/workspace/home/little-tooth-5b50/node_modules/miniflare/dist/src/index.js:3405:16)
    at async #waitForReady (/Users/yqrashawn/workspace/home/little-tooth-5b50/node_modules/miniflare/dist/src/index.js:8530:5)
    at async Miniflare.dispatchFetch (/Users/yqrashawn/workspace/home/little-tooth-5b50/node_modules/miniflare/dist/src/index.js:8599:5)
    at async file:///Users/yqrashawn/workspace/home/little-tooth-5b50/test.mjs:11:18 {
  code: 'ERR_RUNTIME_FAILURE',
  cause: undefined
}

Node.js v21.5.0

yqrashawn avatar Feb 08 '24 12:02 yqrashawn

@tdobson could you try running wrangler pages dev --compatibility-date=2023-12-18 -- npm start? i.e. without --port 3000

penalosa avatar Feb 19 '24 13:02 penalosa

@penalosa same shit...

YMBOLIZER to the location of the llvm-symbolizer binary. When running tests under bazel, use `--test_env=LLVM_SYMBOLIZER=<path>`.
*** Fatal uncaught kj::Exception: kj/compat/tls.c++:72: failed: OpenSSL error; message = error:0900006e:PEM routines:OPENSSL_internal:NO_START_LI
NE

a5r0n avatar Feb 21 '24 16:02 a5r0n

https://github.com/cloudflare/workers-sdk/issues/4420#issuecomment-1825944390

a5r0n avatar Feb 21 '24 16:02 a5r0n

@a5r0n does the comment in cloudflare/workers-sdk#4420 solve your problem (i.e. do you have a malformed certificate file)? If so, we should definitely add some better messaging around this error case, since it seems to be relatively common.

penalosa avatar Feb 26 '24 12:02 penalosa

@penalosa yes it doas. but i'm sure the cert file is okay, is there anyway to check that?

a5r0n avatar Feb 26 '24 12:02 a5r0n

@a5r0n Could you try running NODE_EXTRA_CA_CERTS="" wrangler pages dev --compatibility-date=2023-12-18 -- npm start and see what the output of that is?

penalosa avatar Feb 26 '24 14:02 penalosa

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

127.0.0.1       localhost
#fe80::1         localhost

xeodou avatar Mar 08 '24 14:03 xeodou

OK it looks like there is no more action for us to do here.

In most cases this is due to an invalid cert file, which can be checked by following the instructions here: https://github.com/cloudflare/workers-sdk/issues/4709#issuecomment-1964230217. If that is OK then there is a problem with the cert file.

In the case of @xeodou it seems like the problem was not related to the cert file per se.

petebacondarwin avatar Mar 11 '24 15:03 petebacondarwin

I'm trying to trace a similar problem with 3.63.1 however I'm not using pages, just doing basic wrangler worker development. Reverting to 3,57.1 restores basic wrangler functionality.

I've tried the solutions above regarding certs however I'm not using pages and everything runs fine with 3.57.1.

With 3.63.1, one of the things logging identified is that when wrangler init did not create the .dev or .dev.vars files, which it seems to require now? However creating those files didn't resolve all of the issues. Log file attached.

wrangler-2024-07-06_09-32-36_362.log

memetican avatar Jul 06 '24 10:07 memetican

-------------------------------------------------------

Using vars defined in .dev.vars
โŽ” Starting local server...
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎโ”‚ [b] open a browser, [d] open Devtools, [l] turn off local mode, [c] clear console, [x] to exit                                                                                                          โ”‚โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏC:\Users\ fanbo3\myTestMini\miniapp\dddname\node_modules\wrangler\wrangler-dist\cli.js:29765
            throw a;
            ^

MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
    at #assembleAndUpdateConfig (C:\Users\ \ fanbo3\myTestMini\miniapp\dddname\node_modules\miniflare\dist\src\index.js:9178:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Mutex.runWith (C:\Users\ \fanbo3\myTestMini\miniapp\dddname\node_modules\miniflare\dist\src\index.js:3521:16) {
  code: 'ERR_RUNTIME_FAILURE',
  cause: undefined
}

Node.js v20.15.0`

This question keeps popping up, how should I handle it?

liguob666 avatar Jul 10 '24 06:07 liguob666

I had the same problem. I switched wrangler to wrangler 3.57.1 โ€‹โ€‹and it worked fine.

liguob666 avatar Jul 10 '24 07:07 liguob666

        throw a;
        ^

MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above. at #assembleAndUpdateConfig (C:\Users\Asmin\Desktop\serverless\my-app\node_modules\miniflare\dist\src\index.js:9178:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Mutex.runWith (C:\Users\Asmin\Desktop\serverless\my-app\node_modules\miniflare\dist\src\index.js:3521:16) { code: 'ERR_RUNTIME_FAILURE', cause: undefined }

Node.js v20.11.0

i changed the version to 3.57.1 but still not working image

navtesh21 avatar Jul 12 '24 08:07 navtesh21

I believe you are experiencing an issue with a recent change to workerd that break on Windows 11? See https://github.com/cloudflare/workers-sdk/issues/6170

petebacondarwin avatar Jul 12 '24 08:07 petebacondarwin

I believe you are experiencing an issue with a recent change to workerd that break on Windows 11? See cloudflare/workers-sdk#6170

i have windows 10 can you provide me anything to fix this issue its been an houe now and i am not able to find something

navtesh21 avatar Jul 12 '24 08:07 navtesh21

 ERROR  *** Received structured exception #0xc0000005: access violation; stack: 7ff9ed0e301f 7ff788f594eb 7ff788f595b3 7ff788f4d1ec 7ff788f4d197 7ff7887c832e 7ff7887c863f 7ff7876b1706 7ff7876b14ea 7ff78894047f 7ff788947636 7ff78894099c 7ff788947636 7ff78893e30c 7ff7876a1551 7ff789fdc8df 7ffa0e27257c 7ffa0eb4af27


 ERROR  Failed to initialize wrangler bindings proxy The Workers runtime failed to start. There is likely additional logging output above.

  at Miniflare2.#assembleAndUpdateConfig (node_modules\miniflare\src\index.ts:1343:10)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at Mutex.runWith (node_modules\miniflare\src\workers\shared\sync.ts:66:45)
  at Miniflare2.#waitForReady (node_modules\miniflare\src\index.ts:1425:3)
  at Miniflare2._getProxyClient (node_modules\miniflare\src\index.ts:1631:3)
  at Miniflare2.getBindings (node_modules\miniflare\src\index.ts:1654:23)
  at async getPlatformProxy (node_modules\wrangler\wrangler-dist\cli.js:210786:20)
  at _getPlatformProxy (node_modules\nitro-cloudflare-dev\dist\runtime\plugin.dev.mjs:41:17)

mavrick avatar Jul 16 '24 22:07 mavrick

We have fixed this regression for nitro proxy using this method.

pi0 avatar Jul 18 '24 08:07 pi0

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

127.0.0.1       localhost
#fe80::1         localhost

How to do this on windows?

Verdant31 avatar Jul 31 '24 15:07 Verdant31

I fixed this error by running npm install [email protected] I changed it from 3.68.0 to 3.57.1

divofred avatar Aug 03 '24 06:08 divofred

@divofred I did the same, but now it gives a warning : Screenshot 2024-08-03 222711

AnantKrSharma avatar Aug 03 '24 16:08 AnantKrSharma

@divofred I did the same, but now it gives a warning : Screenshot 2024-08-03 222711

You just have to change the compatibility date to "2024-05-12" in your wrangler.toml file @AnantKrSharma

divofred avatar Aug 03 '24 17:08 divofred

umm.. is that a good practice ?

AnantKrSharma avatar Aug 03 '24 17:08 AnantKrSharma

umm.. is that a good practice ?

The latest version of wrangler is buggy, so you are downgrading to the previous version. Since you are going back to 3.57.1, it is good practice to change the compatibility date. Hope this makes it clear

divofred avatar Aug 03 '24 17:08 divofred

oh.. so the problem is in Wrangler.. Thanks for your help!

AnantKrSharma avatar Aug 03 '24 17:08 AnantKrSharma