Jonghakseo / chrome-extension-boilerplate-react-vite

Chrome Extension Boilerplate with React + Vite + Typescript
MIT License
2.17k stars 314 forks source link

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

Open IzaGz opened 3 months ago

IzaGz commented 3 months ago

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?

github-actions[bot] commented 3 months ago

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

Jonghakseo commented 3 months ago

Plz check your dev-server

$ pnpm dev-server

This is automatic on pnpm dev from latest version

IzaGz commented 3 months ago

@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 commented 2 months ago

Same issue

IzaGz commented 2 months ago

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

Снимок экрана 2024-06-11 в 00 54 16
Jonghakseo commented 2 months ago

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 commented 2 months ago

@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 commented 2 months ago

Have you tried reloading the extension?

IzaGz commented 2 months ago

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

ulises-castro commented 2 months ago

@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 commented 1 month ago

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

Jonghakseo commented 1 month ago

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

PatrykKuniczak commented 1 month ago

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

image image

Jonghakseo commented 1 month ago

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 commented 1 month ago

@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 commented 1 month ago

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 commented 1 month ago

@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 commented 1 month ago

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 commented 1 month ago

same issue image

MassDo commented 1 month ago

Same issue

Jonghakseo commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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

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

PatrykKuniczak commented 3 weeks ago

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: https://github.com/websockets/ws/issues/1537

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

jjwallace commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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

I'm waiting for https://github.com/Jonghakseo/chrome-extension-boilerplate-react-vite/issues/477#issuecomment-2290868107