godot
godot copied to clipboard
Godot Web Build reloads infinitely on github.io
Tested versions
4.4.dev2 master branch as of 28.09.2024
System information
Any
Issue description
https://github.com/user-attachments/assets/80af8339-850d-414c-b9a1-12313b0eda42
Steps to reproduce
- Go to https://swarkin.github.io/wsclicker
Minimal reproduction project (MRP)
Not a MRP but the project in question: https://github.com/Swarkin/wsclicker
hey - I've been following this project.
tested this and got the same result on ChromeOS
It is caused by following code (note the window.location.reload() at the end): https://github.com/godotengine/godot/blob/76a135926aef1f02f27e4e09093787f2c670956d/misc/dist/html/full-size.html#L153-L171
CC @adamscott
As workaround, you can try disabling the "ensure cross origin isolation headers", or PWAs as a whole, in export options @Swarkin
I cannot do this as I need CORS headers for threads to work...
For me the following error occurs in the console for the running page:
Uncaught (in promise) TypeError: Failed to execute 'addAll' on 'Cache': Request failed
Have you actually built the template with threads? ~The template file doesn't have threads in the name which is normally added, you need to build it with threads explicitly enabled~ (my bad the template has nothreads when disabled)
I cannot do this as I need CORS headers for threads to work...
I haven't done any threaded web apps before, so my assessment might be wrong. But as far as I can read online (search for "github pages cross origin isolation"), you need to do some additional work to enable cross origin isolation headers on github pages. Here is one example I found: https://docs.wasmer.io/sdk/wasmer-js/how-to/coop-coep-headers
But the infinite reload is still something that should be fixed (show an error message on the web page instead).
But the infinite reload is still something that should be fixed (show an error message on the web page instead).
This might be something that happens before the engine can load properly (it seems at least one error happens immediately in the service worker) so might be something we don't have any power over, but not sure exactly where things are breaking exactly
I don't have access to a computer this weekend, but I'll see what I can do Monday.
I cannot do this as I need CORS headers for threads to work...
https://github.com/gzuidhof/coi-serviceworker gets around the use of headers on hosters where you cannot change them
I cannot do this as I need CORS headers for threads to work...
https://github.com/gzuidhof/coi-serviceworker gets around the use of headers on hosters where you cannot change them
We do handle this directly in the Web export template since #86089.
I am still experiencing this issue, website reloading infinitely. I updated my web build from master an hour ago.
Both firefox and chromium, I have reloaded without cache using ctrl+shift+r as well as ticking the disable cache box in the network debugger.
cc @adamscott ^
@Swarkin Did you rename wsclicker_client_web_wasm32.html to index.html?
I did, do I need to rename everything containing wsclicker_client_web_wasm32 to index?
@Swarkin Try exporting the project using index.html as name directly (without any renaming afterwards). We should advise people to never rename files in the docs.
The service worker fails to load wsclicker_client_web_wasm32.html and then everything fails.
Seems like that was the actual issue, even though Im pretty sure that it worked this way in the past? Anyways thank you! Should we convert this into a documentation issue and leave it open?
Seems like that was the actual issue, even though Im pretty sure that it worked this way in the past? Anyways thank you! Should we convert this into a documentation issue and leave it open?
There's definitely something wrong when a file can't be loaded. I'll try to fix the infinite loading.
Weird. I tried to rename in a small test project test.html to index.html, and it still works...
I'll create a PR for the documentation and close this issue. Then, if the problem returns, I'll be there to fix it.