tinybase icon indicating copy to clipboard operation
tinybase copied to clipboard

Cloudflare websocket error "Message is too large"

Open jakubriedl opened this issue 6 months ago • 5 comments

Describe the bug

When synchronizing data over websockets to Cloudflare durable objects and with larger store it hits a limit of message size causing silent fail of sync. There may be many situations when the message gets over 1mb, we're experiencing it with messages 6 = GetCellDiff.

from CF docs:

Note WebSocket messages received by a Worker have a size limit of 1 MiB (1048576). If a larger message is sent, the WebSocket will be automatically closed with a 1009 "Message is too large" response.

I've validated that by logging ws.onclose(console.log)

Probable solution to that is to slice the messages in smaller pieces which not only can resolve this issue but probably also speedup the sync on initial init.

I can look into that in few days, just listing here for visibility.

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

No response

Expected behavior

No response

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response

jakubriedl avatar Jul 15 '25 12:07 jakubriedl