I believe there is a bug with error handling in react-apollo when using server side rendering which causes the error field in a query result to be undefined, even when the errorPolicy is set to all.
Intended outcome:
When a <Query> component is server side renderered with errorPolicy=all, and an error thrown in a resolver, the render props function should be passed a result with an error field being populated as documented here.
Actual outcome:
The error field is undefined on the server.
How to reproduce the issue:
I have created a reproduction example here: https://codesandbox.io/s/3xx4w96o6
I also have a version on github here: https://github.com/ganemone/apollo-ssr-error-handling
Version
- apollo-client@latest
- react-apollo@latest
I believe this is a similar issue to #2655 and #615 however there was some issues with people being rude in those threads so I am creating a new issue here with more clear reproduction steps.
I think this should be somewhat high priority since there is not a viable errorPolicy for gracefully handling errors in server side rendering right now. none will cause renderToStringWithData to throw, and all behaves the same as ignore, so you are forced to either render a full error page or ignore errors completely.
I believe there is a bug with error handling in react-apollo when using server side rendering which causes the
errorfield in a query result to beundefined, even when the errorPolicy is set toall.Intended outcome:
When a
<Query>component is server side renderered with errorPolicy=all, and an error thrown in a resolver, the render props function should be passed a result with anerrorfield being populated as documented here.Actual outcome:
The
errorfield is undefined on the server.How to reproduce the issue:
I have created a reproduction example here: https://codesandbox.io/s/3xx4w96o6
I also have a version on github here: https://github.com/ganemone/apollo-ssr-error-handling
Version
I believe this is a similar issue to #2655 and #615 however there was some issues with people being rude in those threads so I am creating a new issue here with more clear reproduction steps.
I think this should be somewhat high priority since there is not a viable errorPolicy for gracefully handling errors in server side rendering right now.
nonewill causerenderToStringWithDatato throw, andallbehaves the same asignore, so you are forced to either render a full error page or ignore errors completely.