question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

--https mode causes issues in dev by trying to connect to wss://localhost:24678

See original GitHub issue

Describe the bug In --https mode, the site is served at https://localhost:3000 and so the Vite websocket connection that is attempted fails, because it tries to make it at wss://localhost:24678 when it exists at ws://localhost:24678. This results in the page being periodically reloaded.

Logs

Firefox can’t establish a connection to the server at wss://localhost:24678/.
[vite] server connection lost. polling for restart... client:340:13
[vite] connecting...

To Reproduce npx svelte-kit dev --https

Open console and/or network logs and wait. Turn on timestamps on the console to help see what’s happening. The page refresh rate seems to vary widely, and I haven’t figured out what causes that to happen.

Expected behavior I don’t think we can force an HTTPS page to load a non-secured websocket, so we’ll have to figure out how to serve a secure websocket over that port. This will also still probably cause issues because it will be a self-signed cert. I don’t know how to resolve this.

Severity High. HTTPS mode is not very usable if the browser refreshes periodically.

Additional context I told you HTTPS mode was a mistake and you didn’t believe me.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:12
  • Comments:24 (16 by maintainers)

github_iconTop GitHub Comments

3reactions
mankinscommented, Apr 28, 2021

https://github.com/sveltejs/kit/issues/581#issuecomment-805398830 hinted at a way that seems to work for me:

Adding the following to svelte.config.cjs fixed the issue for me (so it uses ws instead of wss and port 3001)

	kit: {
		vite: {
			server: {
				hmr: {
					protocol: 'ws',
					port: 3001
				}
			}
		}
}
3reactions
bbuchanancommented, Apr 8, 2021

This problem has stopped me dead in my tracks. I’m working on a new project w/ oauth and I need an https callback to receive my login token. I hope this gets addressed soon but I’m open to workarounds in the meantime. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WebSocket connection to 'ws://localhost:9090/' failed: Error in ...
I tried to run websocket with the url var wsUri = "ws://localhost:55195/" and it says WebSocket connection to 'ws://localhost:55195/' failed: Have been looking ......
Read more >
Command-Tab
I was attempting to run Nuxt 3 RC1 in development mode behind a local nginx reverse proxy, but ran into several issues. There...
Read more >
Websocket Connection To Wss Failed - AGENZIA FERRARI
Laravel websocket cant connect to pusher ERR_CERT_AUTHORITY_INVALID. Crome gives the error: WebSocket connection to 'wss://localhost:54970/Dashboard.
Read more >
Firefox can't establish a connection to the server at ws://127.0 ...
When i use different Firefox profile, then the localhost site i am ... Tried: FF hamburger menu, Help, Troubleshoot mode... it started ...
Read more >
Websocket issue in shopify Express App on server
This is the errro i am getting in console client.ts:28 WebSocket connection to 'wss://website.com:24678/' failed: (anonymous) @ client:188 ...
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