cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.56k stars 656 forks source link

🐛 BUG: `wrangler dev` crashes when working with large XML documents #6219

Closed uhthomas closed 2 weeks ago

uhthomas commented 2 months ago

Which Cloudflare product(s) does this pertain to?

Workers Runtime, Wrangler core, Miniflare

What version(s) of the tool(s) are you using?

3.63.1 [Wrangler]

What version of Node are you using?

?

What operating system and version are you using?

Arch Linux 6.9.7

Describe the Bug

Observed behavior

I'm using https://www.npmjs.com/package/fast-xml-parser to parse some XML documents from URLs, and it's not possible to test some locally because wrangler crashes.

Expected behavior

Wrangler shouldn't crash?

Steps to reproduce

import { XMLParser } from "fast-xml-parser";

const res = await fetch("https://kubernetes.io/feed.xml");

const { feed } = new XMLParser().parse(await res.text());

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

✘ [ERROR] workerd/jsg/util.c++:278: error: e = kj/compat/http.c++:5754: failed: WebSocket protocol error; protocolError.statusCode = 1009; protocolError.description = Message is too large: 1180545 > 1048576

  stack: /usr/bin/workerd@17fd160 /usr/bin/workerd@17fd47f /usr/bin/workerd@2ee501c
  /usr/bin/workerd@cdb210 /usr/bin/workerd@1821610 /usr/bin/workerd@cdb210 /usr/bin/workerd@102b841;
  sentryErrorContext = jsgInternalError
petebacondarwin commented 1 month ago

This is most probably because in wrangler dev we send the response body in a message over to the "inspector" (i.e. for attaching a debugger) via a WebSocket, and that has a limit on message size. We have a PR on workerd that could allow us to set this to a larger value - see https://github.com/cloudflare/workerd/pull/2164.

penalosa commented 2 weeks ago

This should be fixed now (https://github.com/cloudflare/workerd/pull/2164 was merged and released)