Effect CommunityEC
Effect Community6mo ago
111 replies
johtso

Getting DevTools/Traces for Cloudflare Workers Locally with Wrangler

Edit: ok got it working! had to use BrowserSocket:

const DevToolsLive = DevTools.layerWebSocket().pipe(
  Layer.provide(BrowserSocket.layerWebSocketConstructor),
)


is there any way to get devtools / traces when running a cloudflare worker locally with wrangler?

I get:
✘ [ERROR] service core:user:xero-token-broker: Uncaught ReferenceError: MessagePort is not defined

    at null.<anonymous> (index.js:6499:59) in
  ../../node_modules/.pnpm/undici@7.11.0/node_modules/undici/lib/web/webidl/index.js
    at null.<anonymous> (index.js:12:50) in __require
    at null.<anonymous> (index.js:6901:22) in
  ../../node_modules/.pnpm/undici@7.11.0/node_modules/undici/lib/web/fetch/util.js
    at null.<anonymous> (index.js:12:50) in __require
    at null.<anonymous> (index.js:18195:9) in
  ../../node_modules/.pnpm/undici@7.11.0/node_modules/undici/lib/web/fetch/headers.js
    at null.<anonymous> (index.js:12:50) in __require
    at null.<anonymous> (index.js:18666:92) in
  ../../node_modules/.pnpm/undici@7.11.0/node_modules/undici/lib/web/fetch/response.js
    at null.<anonymous> (index.js:12:50) in __require
    at null.<anonymous> (index.js:19885:9) in
  ../../node_modules/.pnpm/undici@7.11.0/node_modules/undici/lib/web/fetch/index.js
    at null.<anonymous> (index.js:12:50) in __require


Hmm.. websockets should be supported.. https://developers.cloudflare.com/workers/examples/websockets/#write-a-websocket-client
Was this page helpful?