y-durableobjects icon indicating copy to clipboard operation
y-durableobjects copied to clipboard

feat: Use Cloudflare Workers RPC

Open naporin0624 opened this issue 1 year ago • 2 comments

closed: #19

  • using keyword support
    • As of 2024/04/08, wrangler cannot use using, so you have to do pnpm i -D wrangler@using-keyword-experimental.
    • https://developers.cloudflare.com/workers/runtime-apis/rpc/lifecycle/#how-to-use-the-using-declaration-in-your-worker

memo

PRC can communicate with workers and Durable Objects via serializable objects, but Response, including WebScoket, is not considered Serializable, so miniflare does not work. The same thing happens with v8 isolated.

✘ [ERROR] DOMException {
workers:dev: 
workers:dev:     stack: 'Error: Could not serialize object of type "WebSocket". This type does not support
workers:dev:   serialization.\n' +
workers:dev:       '    at null.<anonymous> (async
workers:dev:   file://[masked]/index.js:9652:35)\n' +
workers:dev:       '    at async dispatch
workers:dev:   (file://[masked]/compose.js:29:17)\n' +
workers:dev:       '    at async dispatch
workers:dev:   (file://[masked]/compose.js:29:17)\n' +
workers:dev:       '    at async cors2
workers:dev:   (file://[masked]/cors/index.js:65:5)\n' +
workers:dev:       '    at async dispatch
workers:dev:   (file://[masked]/compose.js:29:17)\n' +
workers:dev:       '    at null.<anonymous> (async
workers:dev:   file://[masked]/index.js:1006:25)\n' +
workers:dev:       '    at async jsonError
workers:dev:   (file://[masked]/json-error.ts:22:10)\n' +
workers:dev:       '    at async drainBody
workers:dev:   (file://[masked]/middleware-ensure-req-body-drained.ts:5:10)',
workers:dev:     code: 25,
workers:dev:     name: 'DataCloneError',
workers:dev:     message: 'Could not serialize object of type "WebSocket". This type does not support
workers:dev:   serialization.'
workers:dev:   }

naporin0624 avatar Apr 08 '24 12:04 naporin0624

⚠️ No Changeset found

Latest commit: 6a7c705bac95f7e2cb642c3b100cb0d0227f526e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Apr 08 '24 12:04 changeset-bot[bot]

Deploying yjs-worker with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6a7c705
Status: ✅  Deploy successful!
Preview URL: https://b3ce32d1.yjs-worker.pages.dev
Branch Preview URL: https://feat-worker-rpc.yjs-worker.pages.dev

View logs

https://github.com/cloudflare/workerd/issues/2319

naporin0624 avatar Jun 27 '24 10:06 naporin0624