Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

asset load failure results in entire page broken #13519

Open
itssumitrai opened this issue Feb 28, 2025 · 3 comments · May be fixed by #13521
Open

asset load failure results in entire page broken #13519

itssumitrai opened this issue Feb 28, 2025 · 3 comments · May be fixed by #13521
Labels
feature / enhancement New feature or request needs-decision Not sure if we want to do this yet, also design work needed

Comments

@itssumitrai
Copy link

itssumitrai commented Feb 28, 2025

Describe the bug

This is the same bug as reported in #2699
I am only opening a new one as the previous one was closed and might not get any traction. If you want to reopen the old one, feel free to close this as duplicate.

This is a real world problem any asset load failure during network fluctuation results in entire page broken even when the page is fully Server side rendered. This is a problem affecting real users, and we are really hoping to get this resolved for our Yahoo Finance users.

Image

Proposal

Introduce an option in kit which when enabled, is going to catch such errors, so we don't show the default error page and atleast show the server side rendered markup.

Reproduction

https://github.com/benmccann/500-import-failure

Logs

System Info

System:
    OS: macOS 14.7.4
    CPU: (12) arm64 Apple M3 Pro
    Memory: 69.66 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.20.4 - ~/.nvm/versions/node/v18.20.4/bin/node
    npm: 10.7.0 - ~/.nvm/versions/node/v18.20.4/bin/npm
  Browsers:
    Chrome: 133.0.6943.142
    Safari: 18.3
  npmPackages:
    @sveltejs/adapter-node: ^5.2.9 => 5.2.9
    @sveltejs/kit: ^2.10.1 => 2.10.1
    @sveltejs/vite-plugin-svelte: ^3.1.2 => 4.0.4
    svelte: ^4.2.19 => 5.16.2
    vite: 5.2.13 => 5.2.13

Severity

blocking all usage of SvelteKit

Additional Information

No response

@itssumitrai
Copy link
Author

More context: Locally just having not rendering root error page here

if (error instanceof Redirect) {
is the perfect behavior we are looking for

@dummdidumm
Copy link
Member

dummdidumm commented Feb 28, 2025

Could you provide an updated reproduction (the linked one is completely outdated and I don't know how to upgrade it to a place where the error is observable using current SvelteKit and Vite)? I'm having trouble to understand in which step exactly the error is occuring for you (the one you mentioned is about loading nodes, not doing the component rendering)

Update: Ok I think I know what you mean - if loading one of the entry JS page nodes (entry/2.js for example) fails, then the error is rendered.
Other errors could occur when hydration fails for some reason, but that sounds not like the case you run into.

@itssumitrai
Copy link
Author

So, an easy way to reproduce is to block js file in network tab on chrome devtools. Yes, I am talking mostly about asset file failing and the default error gets rendered, even though there is a perfectly fine Server side rendered markup on the page.

I added

hydrate = false;
return;

here

if (error instanceof Redirect) {
and that's the kind of behavior desired in this case. Though we probably want to keep this behavior behind some kind of option

@dummdidumm dummdidumm linked a pull request Feb 28, 2025 that will close this issue
5 tasks
@eltigerchino eltigerchino added the feature / enhancement New feature or request label Mar 3, 2025
@elliott-with-the-longest-name-on-github elliott-with-the-longest-name-on-github added the needs-decision Not sure if we want to do this yet, also design work needed label Mar 4, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature / enhancement New feature or request needs-decision Not sure if we want to do this yet, also design work needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants