naporitan
naporitan
CDCloudflare Developers
Created by naporitan on 4/12/2024 in #workers-help
Using WebSockets with PRC in Cloudflare Worker
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: }
[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: }
2 replies
CDCloudflare Developers
Created by naporitan on 4/12/2024 in #pages-help
Setting DurableObject from wrangler.toml results in an error.
DurableObjects created with CloudflareWorker can be registered with CloudflarePages. However, if I use wrangler pages download config <project-name> to create wrangler.toml and then deploy again, `This namespace no longer exists and can not be read from or written to. Please try using a different namespace.
# Generated by Wrangler on Fri Apr 12 2024 07:46:59 GMT+0900 (Japan Standard Time)
name = "pages"
pages_build_output_dir = ""
compatibility_date = "2024-04-11"


[[durable_objects.bindings]]
name = "SHARE_MESSAGE"
class_name = "ShareMessage"
script_name = "service"

[env.production]
compatibility_date = "2024-04-11"

[[env.production.durable_objects.bindings]]
name = "SHARE_MESSAGE"
class_name = "ShareMessage"
script_name = "service"
# Generated by Wrangler on Fri Apr 12 2024 07:46:59 GMT+0900 (Japan Standard Time)
name = "pages"
pages_build_output_dir = ""
compatibility_date = "2024-04-11"


[[durable_objects.bindings]]
name = "SHARE_MESSAGE"
class_name = "ShareMessage"
script_name = "service"

[env.production]
compatibility_date = "2024-04-11"

[[env.production.durable_objects.bindings]]
name = "SHARE_MESSAGE"
class_name = "ShareMessage"
script_name = "service"
4 replies