`Request entity is too large` when deploying a worker

I'm working on deploying a worker that is fairly large. I'm using open-next to bundle a next.js site. The worker bundles fine, but I'm not getting a an error message when deploying it ✘ [ERROR] A request to the Cloudflare API (/accounts/xxx/workers/scripts/wesbos/versions) failed. Request entity is too large [code: 7011] All the assets seem to upload fine, it's when wrangler goes to upload the worker itself. The size of the worker is well under the 10mb limit of my plan:
Total Upload: 61269.86 KiB / gzip: 8035.81 KiB
Total Upload: 61269.86 KiB / gzip: 8035.81 KiB
THe largest file is handler.mjs which is 37mb (not gzipped). I don't see any documentation on there being a per-file limit. How do I figure out what is causing this error? I even turned on a proxy to debug the API
13 Replies
James
James2w ago
Enabling WRANGLER_LOG=debug env might help get some more debug information. But if the API is throwing that error, probably something out of your control.
wesbos
wesbosOP2w ago
yeah the API gives no info about what file is causing it I assue its the largest one - but thats a guess? Where are the docs for the limitations? how would I do that?
James
James2w ago
I'm not sure old builds are relevant here. That error is being thrown somewhere in Cloudflare's API - I honestly suspect the 61MB Worker is just too massive for their API to parse AFAIK, wrangler uploads the raw 61MB, even though it logs the gzip number and that's the actual enforced limit I'd also not be surprised if a 61MB worker hits the startup time limit too honestly
wesbos
wesbosOP2w ago
Hrmm, it deploys when I disable image parsing (which causes lots of imports). The main handler file is still 35.2mb though Total Upload: 41462.99 KiB / gzip: 7095.99 KiB If i deploy with wrangler deploy --minify it clocks in like this and uploads. Is there a 50mb limit not documented? Total Upload: 49692.29 KiB / gzip: 7303.47 KiB
Walshy
Walshy2w ago
Nope, I think you're just hitting an unintended limit haha - I checked on this a little today but it's not something we're enforcing (hence the generic error message) I'll dig into it more tomorrow
wesbos
wesbosOP2w ago
@Walshy thank you!
wesbos
wesbosOP2w ago
@Walshy Here is the proxied request that fails with wrangler deploy. It's this endpoint: https://developers.cloudflare.com/api/resources/workers/subresources/scripts/subresources/versions/
Cloudflare API | Workers › Scripts › Versions
Interact with Cloudflare's products and services via the Cloudflare API
No description
wesbos
wesbosOP2w ago
@Walshy | Workers/Pages any ideas here?
Walshy
Walshy2w ago
Sorry for the delay, I didn't have too much time to dig yesterday but spent the morning doing so. I've confirmed it's failing before the Workers service is even hit - I can get a 60 MB upload working in the service itself without issue I'm reaching out to the teams responsible for where I believe it's failing and looking to get that fixed Found where the limit is being enforced, fix is on it's way :)
James
James2w ago
Thanks Walshy! :MeowHeartCloudflare:
wesbos
wesbosOP2w ago
Ayeee thank you!
Walshy
Walshy2w ago
Hey Wes this has now been rolled out to production, let me know if you hit any other issues :)
wesbos
wesbosOP2w ago
thank you! Seems to be deplopying right now but My bundle in under 50mb right now. Gotta get those numbers back up 🤣

Did you find this page helpful?