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

Wrangler cli dev & remote dev both not working suddenly

Open Saptarshi-Chakraborty opened this issue 1 month ago • 5 comments

What versions & operating system are you using?

System:

  • OS: Windows 10 10.0.19045
  • CPU: (8) x64 Intel(R) Core(TM) i5-9300H CPU @ 2.40GHz
  • Memory: 1.04 GB / 7.88 GB

Binaries:

  • Node: 22.17.1 - C:\Program Files\nodejs\node.EXE
  • npm: 11.5.2 - C:\Program Files\nodejs\npm.CMD
  • bun: 1.3.0 - C:\Users\Lenovo-User\AppData\Roaming\npm\bun.CMD

Please provide a link to a minimal reproduction

https://github.com/Saptarshi-Chakraborty

Describe the Bug

Today I tried to run wrangler dev & wrangler dev --remote in my existing Cloudflare Workers project. It crashed every time I tried to start the server. Both the dev and remote dev. But it was working fine yesterday.

The project was a standard Cloudflare worker project, utilizing Bun, Hyperdrive, and Drizzle ORM.

I thought that I had changed my location and Wi-Fi, which is why the issue is occurring. I updated my wrangler cli to the latest version (4.53.0) with npm, logged out, and then again logged in properly with wrangler cli. Everything happened smoothly.

Still, the server did not start.

I am attaching the log files (both before the incident and current logs) also for better debugging.

Please provide any relevant error logs

wrangler-2025-12-10_19-35-16_803.log

wrangler-2025-12-10_19-34-26_679.log

wrangler-2025-12-10_19-24-58_982.log

Saptarshi-Chakraborty avatar Dec 10 '25 19:12 Saptarshi-Chakraborty

The error seems to be (from the logs)

--- 2025-12-10T19:35:21.996Z error
X [ERROR] service core:user:backend: Uncaught TypeError: Cannot read properties of undefined (reading 'map')

    at null.<anonymous> (index.js:1709:17) in route
    at null.<anonymous> (index.js:21179:10)

Do you have a repro?

vicb avatar Dec 11 '25 16:12 vicb

I don't know how to send a proper reproduction step for this error.

It's one of my private GitHub repositories. If you want, I can send you the access to that private GitHub repo.

This is the terminal code when I tried to run the remote dev server via Wrangler Cli.

Error on remote worker: APIError: A request to the Cloudflare API (/accounts/15dc64a778ef56497c3f28cfd01d3155/workers/scripts/backend/edge-preview) failed.
      at throwFetchError (E:\Coding and
  Programming\xplorica\phoenix-app-2-0\backend-new\node_modules\wrangler\wrangler-dist\cli.js:119950:18)
      at fetchResult (E:\Coding and
  Programming\xplorica\phoenix-app-2-0\backend-new\node_modules\wrangler\wrangler-dist\cli.js:119846:5)
      at process.processTicksAndRejections
  (node:internal/process/task_queues:105:5)
      at async createPreviewToken (E:\Coding and
  Programming\xplorica\phoenix-app-2-0\backend-new\node_modules\wrangler\wrangler-dist\cli.js:282599:39)
      at async createWorkerPreview (E:\Coding and
  Programming\xplorica\phoenix-app-2-0\backend-new\node_modules\wrangler\wrangler-dist\cli.js:282621:17)
      at async #previewToken (E:\Coding and
  Programming\xplorica\phoenix-app-2-0\backend-new\node_modules\wrangler\wrangler-dist\cli.js:282953:38)
      at async #updatePreviewToken (E:\Coding and
  Programming\xplorica\phoenix-app-2-0\backend-new\node_modules\wrangler\wrangler-dist\cli.js:283032:23)
      at async #onBundleComplete (E:\Coding and
  Programming\xplorica\phoenix-app-2-0\backend-new\node_modules\wrangler\wrangler-dist\cli.js:283108:11)
      at async Mutex.runWith (E:\Coding and
  Programming\xplorica\phoenix-app-2-0\backend-new\node_modules\miniflare\dist\src\index.js:38902:48)
  {
    telemetryMessage: undefined,
    text: 'A request to the Cloudflare API
  (/accounts/15dc64a778ef56497c3f28cfd01d3155/workers/scripts/backend/edge-preview)
  failed.',
    notes: [
      {
        text: "Uncaught TypeError: Cannot read properties of    
  undefined (reading 'map')\n" +
          '  at index.js:1612:17 in route\n' +
          '  at index.js:13978:5\n' +
          ' [code: 10021]\n' +
          'To learn more about this error, visit:
  https://developers.cloudflare.com/workers/observability/errors/#validation-errors-10021'
      }
    ],
    location: undefined,
    kind: 'error',
    code: 10021,
    accountTag: '15dc64a778ef56497c3f28cfd01d3155'
  }

X [ERROR] A request to the Cloudflare API (/accounts/15dc64a778ef56497c3f28cfd01d3155/workers/scripts/backend/edge-preview) failed.

Saptarshi-Chakraborty avatar Dec 11 '25 22:12 Saptarshi-Chakraborty

@Saptarshi-Chakraborty I can take a look next week if you are able to send me an invite to your repo (and it doesn't contain confidential info)

vicb avatar Dec 12 '25 10:12 vicb

I have sent you an invite to my Repo (https://github.com/Saptarshi-Chakraborty/phoenix-app-2.0-backend) . You can accept it, then clone and run it via bun.

Till now, it does not contain any sensitive info. My Database is a Neon DB.

I desperately want to close this issue as soon as possible, as my work has been stopped for 2 days. I would love it if you could take a look at this matter and help me out.

Saptarshi-Chakraborty avatar Dec 12 '25 11:12 Saptarshi-Chakraborty

On a fresh clone:

-> % bun run dev
$ wrangler dev

 ⛅️ wrangler 4.49.0 (update available 4.54.0)
─────────────────────────────────────────────

✘ [ERROR] When developing locally, you should use a local Postgres connection string to emulate Hyperdrive functionality. Please setup Postgres locally and set the value of the 'CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE' variable or "HYPERDRIVE"'s "localConnectionString" to the Postgres connection string.


🪵  Logs were written [...]

After commenting out the binding:

-> % bun run dev
$ wrangler dev

 ⛅️ wrangler 4.49.0 (update available 4.54.0)
─────────────────────────────────────────────
Your Worker has access to the following bindings:
Binding                 Resource                  Mode
env.IS_DEV (false)      Environment Variable      local

╭──────────────────────────────────────────────────────────────────────╮
│  [b] open a browser [d] open devtools [c] clear console [x] to exit  │
╰──────────────────────────────────────────────────────────────────────╯

✘ [ERROR] Build failed with 5 errors:

  ✘ [ERROR] Could not resolve
  "./functions/admin/admin-events-routes"
  
      src/index.js:3:27:
        3 │ import eventsAdminApp from "./functions/admin/admin-events-routes";
          ╵                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  
  ✘ [ERROR] Could not resolve
  "./functions/orders/orders-route"
  
      src/index.js:13:22:
        13 │ import ordersApp from "./functions/orders/orders-route";
           ╵                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[...]

Please make sure you repro is up to date and/or send detailed instructions. Thanks

vicb avatar Dec 12 '25 14:12 vicb