Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constantly getting error in console WebSocket connection to 'ws://localhost:8081/' failed: #477

Open
IzaGz opened this issue May 21, 2024 · 29 comments · May be fixed by #852
Open

Constantly getting error in console WebSocket connection to 'ws://localhost:8081/' failed: #477

IzaGz opened this issue May 21, 2024 · 29 comments · May be fixed by #852
Assignees
Labels
bug Something isn't working low-priority wontfix This will not be worked on

Comments

@IzaGz
Copy link

IzaGz commented May 21, 2024

Open console and see this error:
Reload server disconnected. Please check if the WebSocket server is running properly on ws://localhost:8081. This feature detects changes in the code and helps the browser to reload the extension or refresh the current tab.

Снимок экрана 2024-05-22 в 01 43 07

also in messages (not errors):
Снимок экрана 2024-05-22 в 01 48 43

This clogs the console, not convenient.
How to fix this?

@IzaGz IzaGz added the bug Something isn't working label May 21, 2024
Copy link

Thank you for your contribution. We will check and reply to you as soon as possible.

@Jonghakseo
Copy link
Owner

Jonghakseo commented May 24, 2024

Plz check your dev-server

$ pnpm dev-server

This is automatic on pnpm dev from latest version

@IzaGz
Copy link
Author

IzaGz commented Jun 10, 2024

@Jonghakseo
i am trying latest version , starting it as pnpm dev but still getting this error,
i have tried to run the pnpm dev in separate terminal and getting error that this is already running
image

WebSocket connection to 'ws://localhost:8081/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

@ulises-castro
Copy link

Same issue

@IzaGz
Copy link
Author

IzaGz commented Jun 21, 2024

still getting this
@PatrykKuniczak @Jonghakseo Can you please, reaopen this issue?

Снимок экрана 2024-06-11 в 00 54 16

@Jonghakseo Jonghakseo reopened this Jun 21, 2024
@Jonghakseo
Copy link
Owner

Jonghakseo commented Jun 23, 2024

Have you checked to see if there are any other processes already occupying port 8081? And would like some information about the operating environment (OS, node version, etc.)?

@IzaGz
Copy link
Author

IzaGz commented Jul 3, 2024

@Jonghakseo there is no other processes running the 8081, only dev-server starting ont this port, macOS Sonoma 14.5 ,
node -v 20.13.1

@Jonghakseo
Copy link
Owner

Have you tried reloading the extension?

@IzaGz
Copy link
Author

IzaGz commented Jul 9, 2024

@Jonghakseo
Yes! Of course, sometimes this error goes away after reload. But why is this happening again?

@ulises-castro
Copy link

@Jonghakseo there is no other processes running the 8081, only dev-server starting ont this port, macOS Sonoma 14.5 , node -v 20.13.1

I'm on Sonoma 14.5, and node v21.
I had tried reloading the chrome extension but it didn't fix it, maybe there is a new firewall policy about websocket or maybe something related to Nodejs?

@Jonghakseo
Copy link
Owner

Jonghakseo commented Jul 13, 2024

I've tried the same node version on Sonoma 14.5, but it doesn't reproduce the issue, which is interesting... 🫠

@Jonghakseo
Copy link
Owner

Can I know the browser information? I'm curious about your Chrome version.

@Jonghakseo Jonghakseo added the help wanted Extra attention is needed label Jul 13, 2024
@PatrykKuniczak
Copy link
Collaborator

PatrykKuniczak commented Jul 13, 2024

@Jonghakseo I have the same problem on Windows, version of Chrome is 126.0.6478.127

image
image

@Jonghakseo
Copy link
Owner

Exactly the same version, but not reproducible... It's not like you're running more than one boilerplate project, right?

스크린샷 2024-07-14 오후 10 13 53

@PatrykKuniczak
Copy link
Collaborator

PatrykKuniczak commented Jul 14, 2024

@Jonghakseo No, one

But there's some strange things when i stop dev script and try to rerun, sometimes i have an info about "On this port sth running already" so kind of this.

No i struggling with this, and i was tried to restart PC and i hope it work now.
I tried to kill task on this port but after few seconds that task become active again ... xD

PS: Don't stop this task it's annoying
image

I was restarted PC and play some music on YT and cooking about 30 min. then i sit down and run 'pnpm dev' and this error occur again

@PatrykKuniczak
Copy link
Collaborator

What's going on here
image

I can't shut down this process.

OOO i'm lucky i do some chances in code, and i can run dev script, it's crazzy.

@PatrykKuniczak
Copy link
Collaborator

@Jonghakseo OO probably i see what's going on.

If i get any error, then script break and when i trying to rerun manually after error, that error about running process on port occur.

Maybe it's related

@Jonghakseo
Copy link
Owner

I'll have to take a look at the code and issues in other HMR projects that use websockets...
I don't have a clue yet.

@thavguard
Copy link

same issue
image

@massdo
Copy link

massdo commented Jul 31, 2024

Same issue

@Jonghakseo
Copy link
Owner

To those who reported this issue...

Is HMR not working properly due to this issue, or is it working properly after reloading the extension?

If you were developing with pnpm dev and shut down the local running dev server, it's normal to see the above message, and it should stop when the dev server starts up again.

I'd like to know more specifically if the above issue is interfering with your development.

@IzaGz
Copy link
Author

IzaGz commented Aug 6, 2024

Is HMR not working properly due to this issue, or is it working properly after reloading the extension?'

now i have downloaded latest project version, tried to start it and getting same issue, i have tried to reload and rebuild it, but it is still present

If you were developing with pnpm dev and shut down the local running dev server, it's normal to see the above message, and it should stop when the dev server starts up again.

no, i am getting thouse errors when server is running,
i am using latest chrome version

@Jonghakseo
Copy link
Owner

We're looking for help from people who can reproduce this issue on the Discord channel.

https://discord.com/channels/1263404974830915637/1264515166473551906/1270506301763620915

@PatrykKuniczak PatrykKuniczak mentioned this issue Aug 15, 2024
3 tasks
@PatrykKuniczak
Copy link
Collaborator

Max we can do for now is:

  ws.onerror = () => {
    console.clear();
  };

i was trying to solve this entire yesterday, but it's not able to catch or sth like that.

There's issue about that:
websockets/ws#1537

I was waiting for response, that's interesting case.

@PatrykKuniczak PatrykKuniczak added low-priority and removed help wanted Extra attention is needed high priority labels Aug 15, 2024
@jjwallace
Copy link

jjwallace commented Aug 18, 2024

image

I also get the same in Ubuntu with Brave and now with the pnpm dev command I get the above ws problem.
Port is open, restarted machine and everything.

Update: deleting lock files fixed my issue, still get the ws console log spamming

@PatrykKuniczak
Copy link
Collaborator

image

I also get the same in Ubuntu with Brave and now with the pnpm dev command I get the above ws problem. Port is open, restarted machine and everything.

Update: deleting lock files fixed my issue, still get the ws console log spamming

Yeah, that's issue between package versions, cause i recently change 'ws' from deps to 'devDeps'

That's why remove node_module script is necessary @Jonghakseo :)

We need to implement it, for upgrade pnpm clean 😄

@PatrykKuniczak
Copy link
Collaborator

PatrykKuniczak commented Aug 18, 2024

@jjwallace We cannot do nothing with it, i spent 2 days of trying to find solution, but nothing works.

I'm waiting for #477 (comment)

@ulises-castro
Copy link

ulises-castro commented Sep 25, 2024

I was using Brave (latest version), then I switch to Microsoft Edge and now HMR is working properly and Websocket connection is established.
I'm not sure why it does not work ws properly on Brave yet.

@PatrykKuniczak
Copy link
Collaborator

#719 Doesn't solve this issue, it still happening, i think it's issue browser related.

I was reading a little about it and it's probably because of security issue.

I think, we can close it here.

But for people which will read this thread in the future.
Feel free to read here, if this issue will be very annoying for you, we will try one more time to create solution for this, maybe some kind of custom thing.

@PatrykKuniczak PatrykKuniczak linked a pull request Jan 30, 2025 that will close this issue
3 tasks
@PatrykKuniczak PatrykKuniczak linked a pull request Jan 30, 2025 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low-priority wontfix This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants