sveltejs/sapper

Failing to reload in dev mode

Closed this issue · 11 comments

Describe the bug
When changing something in the code (seems to be on every change). Chrome based browsers seem to wait for an avaiable socket.

image

Logs
Nothing in the logs

To Reproduce
svelte@3.24.1
sapper@0.28.0

Change some code, and wait for it to hang.

Expected behavior
The browser just to refresh. Also refreshing, hard refreshing, clearing the application data does not change anything.

I don't believe this is an issue with Sapper. Have a google for "Waiting for available socket..." and try troubleshooting your issue there. http://www.fixotip.com/how-to-fix-error-waiting-for-available-sockets-in-google-chrome/

I would suggest trying in another browser / incognito mode.

@antony i can't tell if the bug is related to sapper, but i've had the same problem for a few days now. I have been able to find out that it's the service worker. This one cannot be registered by Chrome - for whatever reason. So the above mentioned error occurs.

Bildschirmfoto 2020-08-19 um 17 12 06

as soon as i select unregister in the chrome tools, the endless loop stops and the page is displayed completely. if you refresh the page, the same thing starts all over again...

Note: I have not changed anything on the service-worker.js file

I hope this clarifies things for you

@antony @neoel

UPDATE:

If I access the page using my internal IP: http://<IP>:3000 the service worker is successfully registered and the error no longer occurs...

See if the note I added here helps you - https://sapper.svelte.dev/docs#static

@antony thanks for the hint, but that still doesn't explain why it works over the internal IP address and not over localhost...
Unfortunately I have to state that no service worker is registered by the call via the IP address...

If no service worker is registered via the IP address, then how can it work?

@antony I'm afraid I can't tell you that either. What I've just discovered: My static folder was larger than 50MB. I have now brought it below 50MB so that the error with the socket no longer occurs. But no service worker can be registered now, for whatever reason...

Bildschirmfoto 2020-08-19 um 17 38 12

Bildschirmfoto 2020-08-19 um 17 40 43

Note: I am using express instead of polka

I would consider removing the existing two, and ensuring that you have restarted the application.

If you need some more help with this, please come and chat to us on discord for support, where we can delve a little deeper into your problem, as this isn't an issue with Sapper.

@antony sorry for all the back and forth... I was just able to fix that bug myself. I just forgot to completely restart my sapper server. Thanks for your quick support. Sapper and Svelte really have a great community 👍 💯

I'm facing a similar issue, I'll try to explain as best I can:

  1. I added a bunch of font files (.woff and .woff2) to my static directory. 30 total font files, but I checked the size of the static directory and it's 12.1MB.

  2. I loaded my site in Chrome and I see this in the Network console tab:

Screen Shot 2020-08-19 at 11 35 24 AM

I'm also using ssl for my local dev, so I visit https://localhost (could this cause issues with the event running at http://localhost:10000/__sapper__?).

  1. This eventsource continues to run, for how long I'm not sure, I never wait until the end. If I keep refreshing, this eventsource just starts over.

  2. However, if I edit a file and a rebuild occurs (by the way, should the rebuilding message appear twice?):

Screen Shot 2020-08-19 at 11 37 17 AM

and then refresh (because livereload does not work any more), then in the network console tab you see a bunch of font files that have been fetched and a few more that are pending and the site hangs with the "waiting for available socket" chrome error.

UPDATE
I thought the static folder size limit was 50MB, not 5MB. Reducing my folder size seems to have eliminated this issue.

Glad you fixed it. I'd contest that the issue is related - you've misunderstood how an event source works (it's not supposed to stop, it's a constant source of events), and your rebuild errors show that your server has failed to run, which will of course stop livereload working.

There is no folder size limit for static, the note is specifically to point out that if you try to add more than 50mb to any service worker, you'll start to encounter limitations of service workers and current browsers.