[Error] WebSocket connection to 'ws://[::]:4000/ws' failed

See original GitHub issue

Environment

- Operating System: `Darwin`
- Node Version:     `v18.11.0`
- Nuxt Version:     `3.0.0-rc.12`
- Nitro Version:    `0.6.0`
- Package Manager:  `npm@8.19.2`
- Builder:          `vite`
- User Config:      `experimental`, `build`, `buildModules`, `modules`, `publicRuntimeConfig`, `privateRuntimeConfig`, `globalName`, `app`, `intlify`, `http`, `proxy`, `auth`, `tailwindcss`, `googleFonts`, `content`
- Runtime Modules:  `@nuxtjs-alt/auth@2.0.20`, `@nuxtjs-alt/http@1.3.18`, `@nuxtjs-alt/proxy@1.3.5`, `@nuxt/content@2.2.0`, `@nuxtjs/tailwindcss@5.3.5`, `@nuxtjs/google-fonts@3.0.0-0`, `@intlify/nuxt3@0.2.4`, `@pinia/nuxt@0.4.3`
- Build Modules:    `@intlify/nuxt3@0.2.4`

Reproduction

Install Nuxt with nuxt/content on macOS using watcher.

Describe the bug

After upgrading to https://github.com/nuxt/content/releases/tag/v2.2.0 I mentioned errors in dev mode on my Mac:

[Error] WebSocket connection to 'ws://[::]:4000/ws' failed: The Internet connection appears to be offline.
Bildschirmfoto 2022-10-19 um 23 Uhr 16 Minuten und 41 Sekunden@2x

At first I thought it was about the recent update to Nuxt3-rc12 (https://github.com/nuxt/framework/issues/8330), but it turned out that if I disable content watcher like this:

    content: {
        base: '/_content',
        watch: false
    }

the problem does no longer appear.

Additional context

The port itself seems open:

nmap -6 ::1 -Pn -p 4000
Starting Nmap 7.93 ( https://nmap.org ) at 2022-10-19 23:21 CEST
Nmap scan report for localhost (::1)
Host is up (0.00027s latency).

PORT     STATE SERVICE
4000/tcp open  remoteanything

And there is listening something on that port:

lsof -i tcp:4000
COMMAND   PID    USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
node    18648 ahoiroman   44u  IPv6 0x2fa1d5696f4b9643      0t0  TCP *:terabase (LISTEN)

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

1reaction
Sunironcommented, Oct 20, 2022

Same error since i switched from Nuxt 3 RC 10 to RC 12 yesterday.

1reaction
ahoiromancommented, Oct 19, 2022
    content: {
        watch: {
            ws: {
                hostname: 'localhost'
            }
        }
    }

seems to be a workaround, which fixes the problem in Safari. But it would still be nice to have a better solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WebSocket connection to 'ws://localhost:4000/graphql' failed
Hi, I am running into an issue on my front-end (Vue 2) when trying to connect to the web socket. I've tried several...
Read more >
WebSocket connection failed: Error during ... - Stack Overflow
I am trying to integrate Socket.io with Angular and I'm having difficulties making a connection from the client ...
Read more >
Error with WebSocket - Microsoft Q&A
Hello I get the error: WebSocket connection to 'wss://localhost:54970/Dashboard.Server/' failed: Error in connection establishment: net:: ...
Read more >
WebSocket connection to 'wss://...' failed. ASP .Net Core Web ...
A fix for this issue has been released! Install the most recent release from https://visualstudio.microsoft.com/downloads/. Thank you for providing valuable ...
Read more >
WebSocket: error event - Web APIs | MDN
The error event is fired when a connection with a WebSocket has been closed due to an error (some data couldn't be sent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found