Skip to content

fix(ssr): reject serverPrefetch with error #901

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 27, 2020
Merged

Conversation

dsanders11
Copy link

@dsanders11 dsanders11 commented Jan 1, 2020

Currently on error the promises used in serverPrefetch are being rejected with no value. Vue doesn't consider this to be an error, which leads to a broken response where the component is not rendered, but SSR considered the render successful, so it's not possible to detect the error.

This should fix #897 and #900.

@Akryum, a quick merge would be appreciated, as currently it's a bit worrisome to use in production since a transient network error could lead to clients getting a broken response.

@vsorrokin
Copy link

Current version of vue-apollo can't be used in production SSR app, this is critical. Please merge this PR ASAP.

@kepek
Copy link

kepek commented Jun 12, 2020

👍

@Akryum Akryum merged commit 22f23eb into vuejs:dev Jul 27, 2020
@dargmuesli
Copy link

Hmm, releasing this as a patch-level change made my project's build break. Something that should be a major-level change.

What's the correct way to handle this error? I guess I could turn off SSR using ssrMode: false within new ApolloClient()?

@brunomperes
Copy link

I think this is a bit arguable, for example one could perform a retry on the client which will automatically happen if the data is not on the exported cache.

With the approach this PR added, there's no way to retry it. The whole server rendering will fail if any request fails. In comparison, using REST one could catch the error and update the markup without causing the whole SSR to fail. Now there is no option.

Since there seem to have use cases, should we instead have an option for failing on SSR requests? Opened #1046 to discuss this.

@dsanders11 dsanders11 deleted the patch-1 branch September 18, 2024 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

the error didnot throw up to Vue
6 participants