Skip to content
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

ssr: on apollo error, error not passed to component (v2 and v3) #6612

Open
maapteh opened this issue Jul 16, 2020 · 4 comments
Open

ssr: on apollo error, error not passed to component (v2 and v3) #6612

maapteh opened this issue Jul 16, 2020 · 4 comments

Comments

@maapteh
Copy link

maapteh commented Jul 16, 2020

Intended outcome:

When having an Apollo Error thrown via GraphQL, the React ssr treewalker should just take the Error and proceed and pass error to the component.

Actual outcome:

When we have one query with an Apollo Error, then the treewalker just throws the Error while treewalking. But this error never reaches the component, while documentation stated it does (saves both data and errors). When i change the errorPolicy to defaults, the errored queries will then also be done client-side, which only puts more load on the server.

For client-side everything works as it should. The errors are passed to error object, data is null.

How to reproduce the issue:

Have one query directly sent an Error on ssr, see my reproduction running at https://codesandbox.io/s/github/maapteh/sandbox-react-apollo-issues-3918

Code is available at maapteh/sandbox-react-apollo-issues-3918

Impact

At the moment we cant move to render more parts to server-side because of this. So we are hacking data to pass the status which is totally not how graphql is meant to be.

"@apollo/client": "^3.0.1",

this is a continuation for apollographql/react-apollo#3918 where i mentioned also in v3rc not working, but that one is archived now

@maapteh maapteh changed the title ssr: on apollo error, error not passed to component ssr: on apollo error, error not passed to component (v2 and v3) Jul 21, 2020
@maapteh
Copy link
Author

maapteh commented Jul 22, 2020

@benjamn can your team please look at this?

@maapteh
Copy link
Author

maapteh commented Nov 15, 2020

@benjamn @hwillson are we going to fix this or push people to urql or update documentation (saying it cant handle ssr errors to client)? Im fine with any outcome, just let me know.

"all: Using the all policy is the best way to notify your users of potential issues while still showing as much data as possible from your server. It saves both data and errors so your UI can use them."

not true :)

@samueljun
Copy link

Here are some relevant findings and repro steps proving that apollo's own two recommended methods for SSR getDataFromTree() vs renderToStringWithData() produce different results because of the lack of error caching #3897 (comment). Seems relevant to this bug report.

@maapteh
Copy link
Author

maapteh commented Nov 27, 2020

To be honest @samueljun i think apollo team doesn't really care about this bug. We are trying to push it into attention for more then a year, and others combined more then 2 years :) Full reproduction paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants