Closed mrvegazhou closed 5 months ago
not sure what you are doing exactly, but as you are also importing the lexical provider I believe you are tying to use it to connect to hocuspocus, which is not supported. The invalid typed array length potentially is caused by us trying to read the documentName from a position that is not supported by their provider.
import * as Y from "yjs"; import {Provider} from '@lexical/yjs'; import { HocuspocusProvider, HocuspocusProviderWebsocket, onStatusParameters } from "@hocuspocus/provider"; const socket = new HocuspocusProviderWebsocket({ url:
ws://localhost:1234
, connect: false, });export function createWebsocketProvider( id: string, yjsDocMap: Map<string, Y.Doc>, token: string ): Provider { const doc = new Y.Doc(); yjsDocMap.set(id, doc);
// @ts-ignore return new HocuspocusProvider({ websocketProvider: socket, name:
test-${id}
, document: doc, token: "my-access-token", onSynced: () => { console.log("HocuspocusProvider synced"); }, onDisconnect: () => { console.log("HocuspocusProvider disconnect"); }, onConnect: () => { console.log("HocuspocusProvider onConnect"); }, onStatus: (data: onStatusParameters) => { console.log(data, "onStatus"); } }); }I run ts-node default.ts on hocuspocus/playground/backend/src path
then console bug : Caught error while handling a Yjs update Error: Unexpected end of array closing connection because of exception RangeError: Invalid typed array length: 4112160217 Caught error while handling a Yjs update Error: Unexpected end of array closing connection because of exception RangeError: Invalid typed array length: 4047902015