cloudflare / workerd

The JavaScript / Wasm runtime that powers Cloudflare Workers
https://blog.cloudflare.com/workerd-open-source-workers-runtime/
Apache License 2.0
6.24k stars 301 forks source link

🐛 BUG: (macOS dev beta) `ERR_RUNTIME_FAILURE` error when using `wrangler dev` #2586

Open Helloyunho opened 3 months ago

Helloyunho commented 3 months ago

FYI, I already made a post in discord but no one was answering

Which Cloudflare product(s) does this pertain to?

Wrangler

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

3.64.0 [Wrangler]

What version of Node are you using?

22.0.0(now 22.4.1 since i upgraded it, but not fixed), but prefer bun 1.1.20

What operating system and version are you using?

macOS Sequoia 15 dev beta 3

Describe the Bug

Observed behavior

I get ERR_RUNTIME_FAILURE error when using wrangler dev CleanShot 2024-07-14 at 21 26 58@2x

Expected behavior

Works without any error, ex) apply db, open dev server, etc.

Steps to reproduce

declare let env: { DB: D1Database }

const app = new Hono()

const adapter = new PrismaD1(env.DB) const prisma = new PrismaClient({ adapter })

function getAuthConfig(c: Context): AuthConfig { return { // auth config... } }

app.use('', initAuthConfig(getAuthConfig)) app.use('/api/auth/', authHandler()) app.route('/api/users', users)

export default app

- A minimal working subset of your `wrangler.toml`
```toml
name = "[REDACTED]"
main = "api/index.ts"
compatibility_date = "2024-03-20"
compatibility_flags = ["nodejs_compat"]

[[d1_databases]]
binding = "DB"
database_name = "[REDACTED]"
database_id = "[REDACTED]"
preview_database_id = "DB"

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

# when using wrangler dev

 ⛅️ wrangler 3.64.0
-------------------

Using vars defined in .dev.vars
Your worker has access to the following bindings:
- D1 Databases:
  - DB: [REDACTED] (DB), Preview: (DB)
- Vars:
  - GOOGLE_ID: "(hidden)"
  - GOOGLE_SECRET: "(hidden)"
  - AUTH_SECRET: "(hidden)"
  - TEBI_ACCESS_ID: "(hidden)"
  - TEBI_ACCESS_SECRET: "(hidden)"
⎔ Starting local server...
╭────────────────────────────────────────────╮
│ [ open a[d open D[ turn off [ clear  [ to  │
│ ]browser, vtools,]local mode]console,]exit │
│                                            │
╰────────────────────────────────────────────╯
/Users/helloyunho/Projects/[REDACTED]/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 (/Users/helloyunho/Projects/[REDACTED]/node_modules/miniflare/dist/src/index.js:9178:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Mutex.runWith (/Users/helloyunho/Projects/[REDACTED]/node_modules/miniflare/dist/src/index.js:3521:16) {
  code: 'ERR_RUNTIME_FAILURE',
  cause: undefined
}

Node.js v22.4.1
Helloyunho commented 3 months ago

side note: I don't really have any other devices to test this so if you have problem replicating the issue let me know another side note: no, the log in the file is not that interesting, just about exactly same as what the terminal says

Helloyunho commented 3 months ago

Fixed EPIPE error by manually(or more like forcibly) updating workerd but now new error... wrangler d1 works fine now though

petebacondarwin commented 3 months ago

We'll try to reproduce this. It is possible that Windows + Node 22 is not working right now. Can you try using Node 18 and see if you still see the problem?

Helloyunho commented 3 months ago

We'll try to reproduce this. It is possible that Windows + Node 22 is not working right now. Can you try using Node 18 and see if you still see the problem?

still getting the same error with Node 18.20.4

Helloyunho commented 3 months ago

@petebacondarwin any idea? my project is basically in hold because of this and I really want this to be fixed asap

stevezhu commented 3 months ago

From my testing, this issue seems to be caused by an update to workerd. The last version without the error is workerd@1.20240614.0, so the first version with the error seems to be workerd@1.20240620.1.

I'm getting the same error on Windows 11, Node v21.0.0

References: https://github.com/cloudflare/workerd/releases/tag/v1.20240620.0 https://github.com/cloudflare/workers-sdk/releases/tag/miniflare%403.20240620.0 https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%403.62.0

Helloyunho commented 3 months ago

From my testing, this issue seems to be caused by an update to workerd. The last version without the error is workerd@1.20240614.0, so the first version with the error seems to be workerd@1.20240620.1.

I'm getting the same error on Windows 11, Node v21.0.0

References: https://github.com/cloudflare/workerd/releases/tag/v1.20240620.0 https://github.com/cloudflare/workers-sdk/releases/tag/miniflare%403.20240620.0 https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%403.62.0

didn't work for me, even the old version has the same problem

stevezhu commented 3 months ago

From my testing, this issue seems to be caused by an update to workerd. The last version without the error is workerd@1.20240614.0, so the first version with the error seems to be workerd@1.20240620.1. I'm getting the same error on Windows 11, Node v21.0.0 References: https://github.com/cloudflare/workerd/releases/tag/v1.20240620.0 https://github.com/cloudflare/workers-sdk/releases/tag/miniflare%403.20240620.0 https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%403.62.0

didn't work for me, even the old version has the same problem

Which version did you install? This config in package.json temporarily fixes it for me

{
  "pnpm": {
    "overrides": {
      "workerd": "1.20240614.0"
    }
  }
}
Helloyunho commented 3 months ago

From my testing, this issue seems to be caused by an update to workerd. The last version without the error is workerd@1.20240614.0, so the first version with the error seems to be workerd@1.20240620.1. I'm getting the same error on Windows 11, Node v21.0.0 References: https://github.com/cloudflare/workerd/releases/tag/v1.20240620.0 https://github.com/cloudflare/workers-sdk/releases/tag/miniflare%403.20240620.0 https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%403.62.0

didn't work for me, even the old version has the same problem

Which version did you install? This config in package.json temporarily fixes it for me

{
  "pnpm": {
    "overrides": {
      "workerd": "1.20240614.0"
    }
  }
}

still the exact same... nothing really changes

stevezhu commented 3 months ago

From my testing, this issue seems to be caused by an update to workerd. The last version without the error is workerd@1.20240614.0, so the first version with the error seems to be workerd@1.20240620.1. I'm getting the same error on Windows 11, Node v21.0.0 References: https://github.com/cloudflare/workerd/releases/tag/v1.20240620.0 https://github.com/cloudflare/workers-sdk/releases/tag/miniflare%403.20240620.0 https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%403.62.0

didn't work for me, even the old version has the same problem

Which version did you install? This config in package.json temporarily fixes it for me

{
  "pnpm": {
    "overrides": {
      "workerd": "1.20240614.0"
    }
  }
}

still the exact same... nothing really changes

Ah not too sure then maybe your issue is caused by a different version. I'm running on Windows 11 so it might be different.

Helloyunho commented 3 months ago

so the same setup works on Ubuntu 24.04, I can use bunx wrangler dev without any issues

GeKorm commented 3 months ago

Had the same issue with wrangler dev and also unstable_dev in tests, but "workerd": "1.20240614.0" works. Windows 10, Node 20.15.1

Helloyunho commented 3 months ago

still having the same error on macOS...

JustJoostNL commented 3 months ago

Can confirm that it's an issue with workerd, after adding the override it works for me.

stevezhu commented 3 months ago

For anyone who is having this issue on windows, this fixed it for me: https://github.com/cloudflare/workers-sdk/issues/6170#issuecomment-2239513454

RamIdeas commented 3 months ago

Thanks for confirming @stevezhu!

For others running into the same issue, please update Visual Studio C++ Redistributable 2015-2022 to version 14.40.33810

Helloyunho commented 3 months ago

@RamIdeas This issue shouldn't be closed since it persists on macOS 15(now dev beta 4). Maybe you misread the issue and thought only Windows users got this error.

Helloyunho commented 2 months ago

Still persists on macOS 15 dev beta 6...

petebacondarwin commented 2 months ago

I'm moving this to the workerd repository because that is where we are likely to see a fix, assuming the problem is not a regression in the MacOS that needs to be resolved there.

ayonn985 commented 2 months ago

Still persists on macOS 15 dev beta 6...

Hello brother, if you still have this issue on the Windows system, please refer to this link for a solution. I have already solved the problem of not being able to run npm run dev or wrangler dev using this method. If you also get a solution as a result, I will be very happy for you. We can become good friends.

link: https://github.com/cloudflare/workers-sdk/issues/6170#issuecomment-2239513454 summarize: Update To Microsoft Visual C++2015-2022 Redistributable (x64) -14.40.33810