cloudflare / cloudflare/workerd

๐Ÿ› BUG: (macOS dev beta) `ERR_RUNTIME_FAILURE` error when using `wrangler dev`

Open
#2,586 26 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
C++
Stars
8.7k
Forks
739
Avg merge
2d 20h
Merged PRs (30d)
174

Description

FYI, I already made [a post in discord](https://discord.com/channels/595317990191398933/1261365846165688412/1261365846165688412) 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](https://github.com/user-attachments/assets/10053449-1bea-4a95-8272-1c631fb513b7)

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

### Steps to reproduce
- A minimal working subset of your worker code
```ts
import { Hono, type Context } from 'hono'
import { authHandler, initAuthConfig, type AuthConfig } from '@hono/auth-js'
import { PrismaAdapter } from '@auth/prisma-adapter'
import { PrismaClient } from '@prisma/client'
import { PrismaD1 } from '@prisma/adapter-d1'
import type { D1Database } from '@cloudflare/workers-types'
import users from './routes/users'

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"
```
- Commands used to start your local dev server, including custom env and cli args
```sh
bunx wrangler dev # or npx wrangler dev, results are same
```
- 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)
- use the command `wrangler dev`, that's it

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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.