WebSocket connection to 'wss://<URL>/_next/webpack-hmr' failed: websocket.js:80
Answered
Catalan Sheepdog posted this in #help-forum
Catalan SheepdogOP
I am facing an issue with the production server of my Next.js application. The error shows in the browser console continuously like an infinite loop.
Edge shows: WebSocket connection to 'wss://<URL>/_next/webpack-hmr' failed: websocket.js:80
Chrome shows: WebSocket connection to 'wss://<URL>/_next/webpack-hmr' failed: WebSocket is closed before the connection is established
Firefox shows this message & freeze the webpage after few seconds. The connection to wss://<URL>/_next/webpack-hmr was interrupted while the page was loading.
These errors only show when running in the hosted VPS server. This error does not show in localhost or Vercel hosting. How can I fix it?
Edge shows: WebSocket connection to 'wss://<URL>/_next/webpack-hmr' failed: websocket.js:80
Chrome shows: WebSocket connection to 'wss://<URL>/_next/webpack-hmr' failed: WebSocket is closed before the connection is established
Firefox shows this message & freeze the webpage after few seconds. The connection to wss://<URL>/_next/webpack-hmr was interrupted while the page was loading.
These errors only show when running in the hosted VPS server. This error does not show in localhost or Vercel hosting. How can I fix it?
Answered by Rafael Almeida
how are you creating the app variable (the return of
next())? make sure dev is set to false3 Replies
the HMR is a dev-only feature, the production server is suppose to be running the production build instead of dev. are you sure you are running the project with
next start? (and not next dev)how are you creating the app variable (the return of
next())? make sure dev is set to falseAnswer
@Rafael Almeida how are you creating the app variable (the return of `next()`)? make sure `dev` is set to `false`
Catalan SheepdogOP
thanks, it worked