Skip to content

Nextjs and Cloudflare build error "cloudflare:workers" is not handled by plugins #614

@zachuri

Description

@zachuri

Issue

Running into a build error with Next.js with Hono and Cloudflare workers. Been trying to resolve this but no solution.

// Main Error thats throwing
cloudflare:workers
Module build failed: UnhandledSchemeError: Reading from "cloudflare:workers" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "cloudflare:" URIs.
// Build
$ next build
Using vars defined in .env
   ▲ Next.js 15.5.4
   - Environments: .env

   Creating an optimized production build ...
Using vars defined in .env
Failed to compile.

cloudflare:workers
Module build failed: UnhandledSchemeError: Reading from "cloudflare:workers" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "cloudflare:" URIs.
    at /Users/zachuri/Documents/my-better-t-app/node_modules/next/dist/compiled/webpack/bundle5.js:29:408351
    at Hook.eval [as callAsync] (eval at create (/Users/zachuri/Documents/my-better-t-app/node_modules/next/dist/compiled/webpack/bundle5.js:14:9224), <anonymous>:
6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/zachuri/Documents/my-better-t-app/node_modules/next/dist/compiled/webpack/bundle5.js:14:6378)
    at Object.processResource (/Users/zachuri/Documents/my-better-t-app/node_modules/next/dist/compiled/webpack/bundle5.js:29:408276)
    at processResource (/Users/zachuri/Documents/my-better-t-app/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)
    at iteratePitchingLoaders (/Users/zachuri/Documents/my-better-t-app/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)
    at runLoaders (/Users/zachuri/Documents/my-better-t-app/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)
    at NormalModule._doBuild (/Users/zachuri/Documents/my-better-t-app/node_modules/next/dist/compiled/webpack/bundle5.js:29:408138)
    at NormalModule.build (/Users/zachuri/Documents/my-better-t-app/node_modules/next/dist/compiled/webpack/bundle5.js:29:410151)
    at /Users/zachuri/Documents/my-better-t-app/node_modules/next/dist/compiled/webpack/bundle5.js:29:82479

Import trace for requested module:
cloudflare:workers
../../packages/auth/src/index.ts
./src/app/dashboard/page.tsx

Configuration

// Better-T-Stack configuration file
// safe to delete
{
  "$schema": "https://r2.better-t-stack.dev/schema.json",
  "version": "3.0.12",
  "createdAt": "2025-10-10T06:27:12.567Z",
  "database": "sqlite",
  "orm": "drizzle",
  "backend": "hono",
  "runtime": "workers",
  "frontend": [
    "next",
    "native-nativewind"
  ],
  "addons": [
    "ruler",
    "turborepo",
    "ultracite"
  ],
  "examples": [
    "ai",
    "todo"
  ],
  "auth": "better-auth",
  "packageManager": "bun",
  "dbSetup": "d1",
  "api": "orpc",
  "webDeploy": "wrangler",
  "serverDeploy": "wrangler"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions