-
Notifications
You must be signed in to change notification settings - Fork 89
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
While implementing NuxtHub Realtime / WebSockets following the official guide:
https://hub.nuxt.com/docs/guides/realtime
I’m seeing two issues depending on the Nitro preset:
cloudflare_durablepreset: WebSocket connections never appear to establish afternpm run build+npm run preview(visitor count stays at 0). In the browser console I also see:
WebSocket connection to 'ws://localhost:8787/ws/visitors' failed:
I get the same “0 visitors” behavior when deploying/running on Cloudflare Workers too.
cloudflare_modulepreset: Works correctly innpm run build+npm run preview, but once deployed to Cloudflare Workers, visitor counts are inconsistent (e.g. sometimes shows 1 visitor with 2 tabs open, sometimes 2, sometimes fluctuates).
This started happening on the latest NuxtHub update (multi-vendo).
Steps to reproduce
Repro A — cloudflare_durable preset (fails in preview + Workers)
- Create a Nuxt app and install NuxtHub.
- Follow the Realtime guide.
- Configure Nitro preset to
cloudflare_durable(as per docs / recommended approach). - Run:
npm run buildnpm run preview
- Open the app in two tabs.
- Observe the Realtime visitors counter stays at 0 (no connections).
(Also reproduced on Cloudflare Workers with the same preset: visitors stay at 0.)
Repro B — cloudflare_module preset (works in preview, inconsistent on Workers)
- Same setup as above, but set Nitro preset to
cloudflare_module(Nitro docs). - Run:
npm run buildnpm run preview
- Open two tabs → visitors count behaves as expected locally.
- Deploy to Cloudflare Workers.
- Open two tabs → visitors count is inconsistent (often shows 1 even with 2 tabs, sometimes 2, sometimes fluctuates).
Expected behavior
- With
cloudflare_durable, afternpm run build+npm run preview, WebSocket connections should work the same way as they do in dev, and the visitors count should increase when opening multiple tabs. - On Cloudflare Workers, visitors count should be stable and accurate for concurrent connections, regardless of preset.
Actual behavior
cloudflare_durable: no working websocket connections in preview (and also seems broken on Workers). Visitors stay at 0.cloudflare_module: preview works, but Workers deployment yields inconsistent visitor counts.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working