is a cloudflare worker compatible with a websocket server?
Hello, I have a nuxt app that I am trying to deploy. It uses a websocket server that the client connects to. When I run
npx wrangler --cwd .output/ dev
I receive the error --- 2025-08-02T15:39:30.872Z debug
Error in LocalRuntimeController: Error reloading local server
MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
at #assembleAndUpdateConfig (C:\Users\xkc\AppData\Local\nvm\v20.19.3\node_modules\wrangler\node_modules\miniflare\dist\src\index.js:25299:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Mutex.runWith (C:\Users\xkc\AppData\Local\nvm\v20.19.3\node_modules\wrangler\node_modules\miniflare\dist\src\index.js:6236:48)
at async #waitForReady (C:\Users\xkc\AppData\Local\nvm\v20.19.3\node_modules\wrangler\node_modules\miniflare\dist\src\index.js:25375:5)
at async #onBundleComplete (C:\Users\xkc\AppData\Local\nvm\v20.19.3\node_modules\wrangler\wrangler-dist\cli.js:179529:33)
at async Mutex.runWith (C:\Users\xkc\AppData\Local\nvm\v20.19.3\node_modules\wrangler\node_modules\miniflare\dist\src\index.js:6236:48) {
code: 'ERR_RUNTIME_FAILURE',
cause: undefined
}
---
As you can see, there isn't much given to let me know what this error is, and why it's occured, thats why im here trying to research. My guess is that I am initializing a webserver socket at start up, but it likely is something else.
Any help is appreciated. Thank you.1 Reply
here is more logging from above
--- 2025-08-02T15:39:30.865Z error
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mservice core:user:yr_front: Uncaught Error: Disallowed operation called within global scope. Asynchronous I/O (ex: fetch() or connect()), setting a timeout, and generating random values are not allowed within global scope. To fix this error, perform this operation within a handler. https://developers.cloudflare.com/workers/runtime-apis/handlers/
[0m
at null.<anonymous> (index.js:16100:68)
at null.<anonymous> (index.js:16135:9) in Jr2
at null.<anonymous> (index.js:16344:9)
at null.<anonymous> (index.js:16348:6) in .output/server/chunks/nitro/nitro.mjs
at null.<anonymous> (index.js:5:59) in __init
at null.<anonymous> (index.js:16571:1)