16

Hi am having this problem, i try to make subscriptions with graphql in nextjs, but something is wrong and i dont have any idea how fix it. I am having websocket error - "WebSocket connection to 'ws:/_next/webpack-hmr' failed: WebSocket is closed before the connection is established."

You can check code here - https://github.com/LoQeN00/messenger-2.0.git

error

graphql-setup

Mateusz Kozłowski
  • 169
  • 1
  • 1
  • 3
  • Please make sure to post code and errors as text directly to the question (and [not as images](https://meta.stackoverflow.com/questions/285551)), and [format them appropriately](https://stackoverflow.com/help/formatting). – juliomalves Apr 27 '22 at 18:18

2 Answers2

8

I restarted my PC and this issue was resolved for me according to this post on github

Cuado
  • 501
  • 1
  • 5
  • 13
  • 1
    As in the link you shared, Neither I have any other middleware/proxy settings, restarting my computer fixed it. The answer was helpful. thanks. – horoyoi o Jan 04 '23 at 09:40
  • 1
    For me it was enough to restart my browser or just re-open the as incognito (maybe an extension was interfering). – gadicc Jun 22 '23 at 07:20
4

I needed to remove

assetPrefix: "./"

from next.config.js so HMR worked and those warnings disappeared. Problem was both in FF and Chrome for me.

kondziorf
  • 117
  • 8