-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
π Bug Report β Vite support: "Message is too large" in WebSocket #1604
Comments
Turns out the message was so big due to inlined sourcemaps. If this is a setting hard to change, we might be able to use |
The problem with increasing this limit for Worker apps is there's currently no way to stream a large message gradually. You can only receive a single whole ArrayBuffer or string representing the message in contiguous memory. Since Workers typically have a memory limit of 128MB, multi-megabyte buffers are problematic. Arguably this line of reasoning doesn't really apply to The ideal fix to this is to add an alternative way to receive messages where large messages can be delivered as ReadableStreams. But, there's some engineering work needed to build that. Do you control this protocol? Is it at all possible to split large messages into multiple pieces? |
I see, thanks for checking this!
It looks like we have enough flexibility in the latest Vite beta to do different things for different types of messages:
Therefore, we can keep the current limit for WS since HMR events should be <1MB π |
Hi π
I'm trying to run Vite in workerd with a similar setup to this. It basically sends code to run in workerd (with dev-only AsyncFunction constructor) via WebSockets.
With a non-trivial app, I'm seeing the following error:
Which seems to come from here in capnproto. It looks like WebSocket messages are quite limited, which might be OK for real apps but it's too small for running Vite.
Is there anyway to get around this? There was a similar fix for devtools websockets but it seems it doesn't affect in-app websockets. -- Maybe
websocket.receive()
could be more generous ifunsafeEvalBinding
is enabled?Thanks!
The text was updated successfully, but these errors were encountered: