puter icon indicating copy to clipboard operation
puter copied to clipboard

Getting 404 error responses when running new release of self-hosted

Open Braingix opened this issue 1 year ago • 7 comments

Issue Description: I am currently facing an issue while trying to run and access the new release of the run-self-hosted implementation for my local development. The problem arises when the server successfully returns the index.html file, but it encounters a 404 error when attempting to fetch other JavaScript (JS) and Cascading Style Sheets (CSS) files. I have verified that these JS and CSS files are indeed available in the repository.

Steps to Reproduce:

  1. Clone or fetch the webserver implementation repository to a local directory.
  2. Start the webserver according to the provided instructions or scripts.
  3. Access the server using a web browser or HTTP client.
  4. Observe that the index.html file is successfully returned by the server.
  5. Attempt to fetch other resources such as JS and CSS files using relative paths from index.html.
  6. Notice that the server returns a 404 error for these JS and CSS files, even though they exist in the repository.

Expected Behavior: I expect the webserver implementation to serve all necessary resources, including JS and CSS files, without encountering 404 errors. Accessing index.html should also result in the correct loading of associated assets.

Actual Behavior: The server successfully returns index.html but returns 404 errors when attempting to fetch other JS and CSS files, despite their presence in the repository.

Additional Information:

  • I have double-checked the paths used to fetch JS and CSS files from index.html to ensure they match the actual paths in the repository.
  • I have also reviewed the configuration files and settings of the webserver implementation to confirm that it is configured to serve static files correctly.
  • Additionally, I have checked file permissions and the server directory structure to ensure that the JS and CSS files are accessible to the webserver.

Environment:

  • Operating System: Windows 10
  • Browser: Chrome

Logs: Here is a screenshot of the log from one of the runs to provide more context Screenshot (84)

Braingix avatar Apr 02 '24 01:04 Braingix

Does the gui still load successfully or does it load a blank/blue page?

KernelDeimos avatar Apr 02 '24 01:04 KernelDeimos

Does the gui still load successfully or does it load a blank/blue page?

Thank you for replying. The loads a blank page as seen here:

Screenshot (85)

And a lot error messages on the console

Screenshot (86)

And the index source

Screenshot (87)

On further inspection I have found that files loaded via the link/src tags were loaded but for reason the scripts are not executed. The problem seems to arise when the browser is teying load the files from paths defined in the manifest.json . See below: Screenshot (89)

Braingix avatar Apr 02 '24 07:04 Braingix

Thanks for the details! I just figured out how to reprod this; I'm working on a fix now

KernelDeimos avatar Apr 02 '24 07:04 KernelDeimos

That was a little tricky! Let me know if it works now. It turns out this happens when localStorage has a stale token. The missing assets as it turns out weren't critical, so if it weren't for this issue we might not have noticed for a while - so I fixed that too!

KernelDeimos avatar Apr 02 '24 08:04 KernelDeimos

~btw, what shell and terminal emulator are you using? The dev console doesn't seem to know the width of the terminal~

edit: I figured it out - Docker doesn't provide the terminal width so this is actually expected behavior

KernelDeimos avatar Apr 02 '24 08:04 KernelDeimos

~btw, what shell and terminal emulator are you using? The dev console doesn't seem to know the width of the terminal~

edit: I figured it out - Docker doesn't provide the terminal width so this is actually expected behavior

Thank you for the work. I am yet to try the fix. I am using bash on windows and I don't encounter any problems when I run the dev-server(npm run start=gui). The error occurs when I run with npm start

Braingix avatar Apr 02 '24 09:04 Braingix

That was a little tricky! Let me know if it works now. It turns out this happens when localStorage has a stale token. The missing assets as it turns out weren't critical, so if it weren't for this issue we might not have noticed for a while - so I fixed that too!

Your changes didn't resolve the issue. After some tedeous check I found that the server was serving assets from thesrc or dist directory, so the urls need to be relative to them not root. I also found a bug with APIError requires and many other parts of the repo. I have fixed the url and APIError bugs and submitted a PR. Thank you.

Braingix avatar Apr 02 '24 15:04 Braingix

This has been finally fixed 😭 Puter should now run in Windows without issues.

jelveh avatar Jul 17 '24 20:07 jelveh