Skip to content

Slow-starting workers give a confusing error message when source maps are enabled #9985

@huw

Description

@huw

What versions & operating system are you using?

Wrangler 4.22.0

Please provide a link to a minimal reproduction

No response

Describe the Bug

Forked this issue from #9818.

When a worker’s startup time is too long and upload_source_maps is enabled in wrangler.json, running wrangler deploy gives the following error (found in the full logs):

--- 2025-07-16T13:48:34.386Z error
�[31m✘ �[41;31m[�[41;97mERROR�[41;31m]�[0m �[1mUnable to determine module type for application/source-map mime type�[0m


---

--- 2025-07-16T13:48:34.386Z debug
Error: Unable to determine module type for application/source-map mime type
    at getModuleType (/workspaces/dev/node_modules/.pnpm/wrangler@4.14.4_@cloudflare+workers-types@4.20250711.0/node_modules/wrangler/wrangler-dist/cli.js:152517:13)
    at /workspaces/dev/node_modules/.pnpm/wrangler@4.14.4_@cloudflare+workers-types@4.20250711.0/node_modules/wrangler/wrangler-dist/cli.js:152530:13
    at Array.map (<anonymous>)
    at convertWorkerBundleToModules (/workspaces/dev/node_modules/.pnpm/wrangler@4.14.4_@cloudflare+workers-types@4.20250711.0/node_modules/wrangler/wrangler-dist/cli.js:152529:33)
    at analyseBundle (/workspaces/dev/node_modules/.pnpm/wrangler@4.14.4_@cloudflare+workers-types@4.20250711.0/node_modules/wrangler/wrangler-dist/cli.js:152583:16)
    at handleStartupError (/workspaces/dev/node_modules/.pnpm/wrangler@4.14.4_@cloudflare+workers-types@4.20250711.0/node_modules/wrangler/wrangler-dist/cli.js:152630:28)
    at helpIfErrorIsSizeOrScriptStartup (/workspaces/dev/node_modules/.pnpm/wrangler@4.14.4_@cloudflare+workers-types@4.20250711.0/node_modules/wrangler/wrangler-dist/cli.js:152650:11)
    at deploy (/workspaces/dev/node_modules/.pnpm/wrangler@4.14.4_@cloudflare+workers-types@4.20250711.0/node_modules/wrangler/wrangler-dist/cli.js:153208:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Object.handler (/workspaces/dev/node_modules/.pnpm/wrangler@4.14.4_@cloudflare+workers-types@4.20250711.0/node_modules/wrangler/wrangler-dist/cli.js:118671:62)
---

As @petebacondarwin noted, this is because the bundle analyser used in startup timeout diagnosis can’t handle source maps. Disabling upload_source_maps fixes this and gives the appropriate error message.

(FWIW, I’m mostly raising this issue so future users find it and it saves them a headache trying to figure out what the error is about; no expectation to really fix it)

Please provide any relevant error logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions