Skip to content

Cloudflare websocket error "Message is too large"Β #261

@jakubriedl

Description

@jakubriedl

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions