Skip to content

Uncaught TypeError: Cannot read properties of undefined (reading '__internal') #11398

@Christonn93

Description

@Christonn93

What versions & operating system are you using?

System:
OS: Windows 11 10.0.26200
CPU: (8) x64 AMD Ryzen 5 7520U with Radeon Graphics
Memory: 3.29 GB / 15.24 GB
Binaries:
Node: 22.15.0 - C:\Program Files\nodejs\node.EXE
npm: 11.6.3 - C:\Program Files\nodejs\npm.CMD
pnpm: 10.18.3 - C:\Users\Chris\AppData\Roaming\npm\pnpm.CMD
bun: 1.3.3 - C:\Users\Chris\AppData\Roaming\npm\bun.CMD

Please provide a link to a minimal reproduction

dont have link...

Describe the Bug

Trying to build a Hono api with connection to cloudflare and d1. Building it with typescript with better-auth, Prisma v7, Hono and bun.
When starting up the server I get an error.

⎔ Starting local server...
X [ERROR] service core:user:learnflow_lms-api: Uncaught TypeError: Cannot read properties of undefined (reading '__internal')

    at null.<anonymous> (index.js:56045:17) in t
    at null.<anonymous> (index.js:74625:17)

X [ERROR] The Workers runtime failed to start. There is likely additional logging output above.

This happend after I upgraded Prisma from version 6.19.0 to version 7.

I'm running the project in a monorepo, using Bvhr

// root/package.json

{
  "name": "learnflow",
  "version": "0.0.1",
  "description": "LearnFlow – A modern Learning Management System (LMS) combining structured learning with real-time collaboration.",
  "author": "Christopher Tønnesland",
  "license": "MIT",
  "homepage": "https://www.chrisdev.no",
  "packageManager": "[email protected]",
  "workspaces": [
    "./server",
    "./client",
    "./shared"
  ],
  "scripts": {
    "dev": "turbo dev",
    "dev:client": "turbo dev --filter=client",
    "dev:server": "turbo dev --filter=server",
    "build": "turbo build",
    "build:client": "turbo build --filter=client",
    "build:server": "turbo build --filter=server",
    "lint": "biome lint .",
    "type-check": "turbo type-check",
    "test": "turbo test",
    "postinstall": "turbo build --filter=shared --filter=server",
    "format": "biome format . --write"
  },
  "keywords": [
    "learning-management-system",
    "lms",
    "education",
    "react",
    "vite",
    "hono",
    "bun",
    "better-auth",
    "tanstack",
    "monorepo",
    "turbo"
  ],
  "devDependencies": {
    "@biomejs/biome": "^2.3.7",
    "bun-types": "latest",
    "turbo": "^2.5.5"
  },
  "peerDependencies": {
    "typescript": "^5.7.3"
  },
  "dependencies": {
    "better-auth": "^1.4.1",
    "i18next": "^25.6.3",
    "zod": "^4.1.13"
  }
}

// server/package.json

{
  "name": "server",
  "version": "0.0.1",
  "main": "dist/index.js",
  "types": "dist/index.d.ts",
  "scripts": {
    "dev": "wrangler dev src/index.ts",
    "dev:remote": "wrangler dev src/index.ts --remote",
    "deploy": "wrangler deploy src/index.ts",
    "prisma:generate": "prisma generate",
    "prisma:migrate": "prisma migrate dev",
    "prisma:studio": "prisma studio",
    "prisma:pull": "prisma db pull",
    "prisma:push": "prisma db push",
    "prisma:reset": "prisma migrate reset --force",
    "prisma:diff": "prisma migrate diff --from-empty --to-schema-datamodel ./src/libs/db/prisma/schema.prisma --script --output ./migrations/$(date +%s)_init.sql",
    "prisma:seed": "prisma db seed",
    "auth:generate": "bunx @better-auth/cli generate --config=src/auth-cli/cli-auth.ts",
    "auth:sync": "bunx @better-auth/cli generate --config=src/auth-cli/cli-auth.ts --output src/libs/db/prisma/schema.prisma",
    "d1:apply:local": "wrangler d1 migrations apply learnflow_lms_db --local",
    "d1:apply:remote": "wrangler d1 migrations apply learnflow_lms_db --remote",
    "d1:execute": "wrangler d1 execute learnflow_lms_db --local --file",
    "d1:seed": "wrangler d1 execute learnflow_lms_db --remote --file src/libs/db/prisma/seed.sql",
    "types:workers": "bunx wrangler types",
    "types:env": "bun ./scripts/gen-env-types.ts",
    "lint": "biome check --write .",
    "format": "biome format --write .",
    "build": "echo 'Cloudflare Workers has no local build step — using wrangler deploy'",
    "test": "bun test",
    "env:check": "bun ./scripts/check-env.ts",
    "prepare": "prisma generate"
  },
  "dependencies": {
    "@prisma/adapter-d1": "^7.0.0",
    "@prisma/client": "^7.0.0",
    "@prisma/extension-accelerate": "^2.0.2",
    "bcrypt": "^6.0.0",
    "better-auth": "^1.4.1",
    "dotenv": "^17.2.3",
    "hono": "^4.7.11",
    "i18next": "^25.6.3",
    "nodemailer": "^7.0.10",
    "pino": "^10.1.0",
    "shared": "workspace:*",
    "zod": "^4.1.13"
  },
  "devDependencies": {
    "@types/bcrypt": "^6.0.0",
    "@types/bun": "latest",
    "prisma": "^7.0.0",
    "typescript": "^5.7.3",
    "wrangler": "^4.50.0"
  }
}

// wrangler.jsonc

{
  "$schema": "../node_modules/wrangler/config-schema.json",
  "name": "learnflow_lms-api",
  "main": "src/index.ts",
  "compatibility_date": "2025-07-18",
  "observability": {
    "enabled": true,
  },
  "compatibility_flags": ["nodejs_compat"],
  "vars": {
    "BETTER_AUTH_URL": "http://localhost:8787",
    "BETTER_AUTH_SECRET": "wyf0......8eW",
  },
  "d1_databases": [
    {
      "binding": "DB",
      "database_name": "learnflow_lms_db",
      "database_id": "c1c.......2c410bd0",
      "migrations_dir": "./src/libs/db/prisma/migrations/001_init_database.sql",
    },
  ],
}


Please provide any relevant error logs

--- 2025-11-25T07:12:50.395Z debug
🪵 Writing logs to "C:\Users~\AppData\Roaming\xdg.config.wrangler\logs\wrangler-2025-11-25_07-12-49_858.log"

--- 2025-11-25T07:12:50.394Z debug
Metrics dispatcher: Posting data {"deviceId":"04f354f5-9ea1-404b-ac9c-6c76f65fbcf6","event":"wrangler command started","timestamp":1764054770394,"properties":{"amplitude_session_id":1764054770387,"amplitude_event_id":0,"wranglerVersion":"4.50.0","osPlatform":"Windows","osVersion":"Windows 11 Home","nodeVersion":22,"packageManager":"bun","isFirstUsage":false,"configFileType":"jsonc","isCI":false,"isPagesCI":false,"isWorkersCI":false,"isInteractive":true,"hasAssets":false,"argsUsed":[],"argsCombination":"","command":"wrangler dev","args":{}}}

--- 2025-11-25T07:12:50.430Z debug
.env file not found at "C:\Users~\OneDrive\Desktop\learnflow_lms\server.env.local". Continuing... For more details, refer to https://developers.cloudflare.com/workers/wrangler/system-environment-variables/

--- 2025-11-25T07:12:50.603Z log

⛅️ wrangler 4.50.0
───────────────────

--- 2025-11-25T07:12:50.653Z debug
setting config

--- 2025-11-25T07:12:50.654Z debug
Updating config... undefined undefined

--- 2025-11-25T07:12:50.790Z log
Using vars defined in .dev.vars

--- 2025-11-25T07:12:50.795Z log
Your Worker has access to the following bindings:

--- 2025-11-25T07:12:50.796Z log
Binding Resource Mode

--- 2025-11-25T07:12:50.797Z log
env.DB (learnflow_lms_db) D1 Database local

--- 2025-11-25T07:12:50.798Z log
env.BETTER_AUTH_URL ("http://localhost:8787") Environment Variable local

--- 2025-11-25T07:12:50.799Z log
env.BETTER_AUTH_SECRET ("(hidden)") Environment Variable local

--- 2025-11-25T07:12:50.800Z log
env.NODE_ENV ("(hidden)") Environment Variable local

--- 2025-11-25T07:12:50.801Z log
env.DATABASE_URL ("(hidden)") Environment Variable local

--- 2025-11-25T07:12:50.802Z log
env.DIRECT_DATABASE_URL ("(hidden)") Environment Variable local

--- 2025-11-25T07:12:50.803Z log
env.GITHUB_CLIENT_ID ("(hidden)") Environment Variable local

--- 2025-11-25T07:12:50.804Z log
env.GITHUB_CLIENT_SECRET ("(hidden)") Environment Variable local

--- 2025-11-25T07:12:50.805Z log
env.SMTP_HOST ("(hidden)") Environment Variable local

--- 2025-11-25T07:12:50.805Z log
env.SMTP_PORT ("(hidden)") Environment Variable local

--- 2025-11-25T07:12:50.806Z log
env.SMTP_SECURE ("(hidden)") Environment Variable local

--- 2025-11-25T07:12:50.806Z log
env.SMTP_USER ("(hidden)") Environment Variable local

--- 2025-11-25T07:12:50.809Z log
env.SMTP_PASS ("(hidden)") Environment Variable local

--- 2025-11-25T07:12:50.815Z log
env.SMTP_FROM ("(hidden)") Environment Variable local

--- 2025-11-25T07:12:50.817Z log
env.CLOUDFLARE_ACCOUNT_ID ("(hidden)") Environment Variable local

--- 2025-11-25T07:12:50.818Z log
env.CLOUDFLARE_ZONE_ID ("(hidden)") Environment Variable local

--- 2025-11-25T07:12:50.819Z log
env.CLOUDFLARE_DATABASE_ID ("(hidden)") Environment Variable local

--- 2025-11-25T07:12:50.819Z log
env.CLOUDFLARE_D1_TOKEN ("(hidden)") Environment Variable local

--- 2025-11-25T07:12:50.820Z log


--- 2025-11-25T07:12:50.905Z log
❓ Your types might be out of date. Re-run wrangler types to ensure your types are correct.

--- 2025-11-25T07:12:53.395Z debug
Writing additional module to output C:\Users~\OneDrive\Desktop\learnflow_lms\server.wrangler\tmp\dev-VzbpVb\225d6627024026c76e82b46856fed8d6eaa49858-query_compiler_bg.wasm

--- 2025-11-25T07:12:53.423Z debug
RemoteRuntimeController teardown beginning...

--- 2025-11-25T07:12:53.424Z debug
RemoteRuntimeController teardown complete

--- 2025-11-25T07:12:53.474Z log
⎔ Starting local server...

--- 2025-11-25T07:12:53.537Z debug
[InspectorProxyWorker] handleProxyControllerIncomingMessage {"type":"reloadStart"}

--- 2025-11-25T07:12:54.925Z error
X [ERROR] service core:user:learnflow_lms-api: Uncaught TypeError: Cannot read properties of undefined (reading '__internal')

at null.<anonymous> (index.js:56045:17) in t
at null.<anonymous> (index.js:74625:17)

--- 2025-11-25T07:12:54.934Z debug
Error in LocalRuntimeController: Error reloading local server
MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
at #assembleAndUpdateConfig (C:\Users~\OneDrive\Desktop\learnflow_lms\node_modules\miniflare\dist\src\index.js:62409:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Mutex.runWith (C:\Users~\OneDrive\Desktop\learnflow_lms\node_modules\miniflare\dist\src\index.js:38880:48)
at async #waitForReady (C:\Users~\OneDrive\Desktop\learnflow_lms\node_modules\miniflare\dist\src\index.js:62496:5)
at async #onBundleComplete (C:\Users~\OneDrive\Desktop\learnflow_lms\node_modules\wrangler\wrangler-dist\cli.js:271340:33)
at async Mutex.runWith (C:\Users~\OneDrive\Desktop\learnflow_lms\node_modules\miniflare\dist\src\index.js:38880:48) {
code: 'ERR_RUNTIME_FAILURE',
cause: undefined
}

--- 2025-11-25T07:12:54.935Z debug
=> Error contextual data: undefined

--- 2025-11-25T07:12:54.937Z log


--- 2025-11-25T07:12:54.943Z error
X [ERROR] The Workers runtime failed to start. There is likely additional logging output above.


--- 2025-11-25T07:12:54.944Z debug
MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
at #assembleAndUpdateConfig (C:\Users~\OneDrive\Desktop\learnflow_lms\node_modules\miniflare\dist\src\index.js:62409:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Mutex.runWith (C:\Users~\OneDrive\Desktop\learnflow_lms\node_modules\miniflare\dist\src\index.js:38880:48)
at async #waitForReady (C:\Users~\OneDrive\Desktop\learnflow_lms\node_modules\miniflare\dist\src\index.js:62496:5)
at async #onBundleComplete (C:\Users~\OneDrive\Desktop\learnflow_lms\node_modules\wrangler\wrangler-dist\cli.js:271340:33)
at async Mutex.runWith (C:\Users~\OneDrive\Desktop\learnflow_lms\node_modules\miniflare\dist\src\index.js:38880:48)

--- 2025-11-25T07:12:54.944Z log
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose

--- 2025-11-25T07:13:00.667Z debug
Sentry: Capturing exception MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.

--- 2025-11-25T07:13:00.677Z debug
Metrics dispatcher: Posting data {"deviceId":"04f354f5-9ea1-404b-ac9c-6c76f65fbcf6","event":"wrangler command errored","timestamp":1764054780677,"properties":{"amplitude_session_id":1764054770387,"amplitude_event_id":1,"wranglerVersion":"4.50.0","osPlatform":"Windows","osVersion":"Windows 11 Home","nodeVersion":22,"packageManager":"bun","isFirstUsage":false,"configFileType":"jsonc","isCI":false,"isPagesCI":false,"isWorkersCI":false,"isInteractive":true,"hasAssets":false,"argsUsed":[],"argsCombination":"","command":"wrangler dev","args":{},"durationMs":10357,"durationSeconds":10.357,"durationMinutes":0.17261666666666667}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    Untriaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions