Closed marfrede closed 1 year ago
Can you create a reproduction case that proves that @apollo/client
works as expected, but apollo-angular
fails ?
@PowerKiKi I will look into this.
@PowerKiKi I was actually able to reproduce the opposite. The same error also exists when using @apollo/client with react.
Thanks for investigating that. It's as I expected. I'll close this issue and we can follow the development on the pre-existing one.
For anyone with the same problem the new issue can be tracked here: https://github.com/apollographql/apollo-client/issues/10559 It should be merged any moment now 😊🎉
Hey all 👋
Apollo Client maintainer here. Just wanted to let you know that this issue is fixed and has been released in @apollo/client
v3.8.2. Thanks!
Describe the bug
In the case of running an Apollo subscription with a query that results in server-side errors while still returning data, regardless of the
errorPolicy
setting chosen, the stream always errors out withApolloError
and the expected data cannot be read. This behaviour is expected forerrorPolicy: none
but neither forerrorPolicy: all
nor forerrorPolicy: ignore
.This makes it impossible to read any
data
when the response message contains errors. Also this behaviour unexpectedly differs from apollo queries as it only appears for apollo subscriptions and not for apollo queries, which behave as expected.To Reproduce
Steps to reproduce the behavior:
Run the same Apollo subscription with a query for which the server responds with errors three times, each with a different
errorPolicy
setting:Now observe that in neither case the response is logged (
tap
is never reached) but in every case the error can be caught, meaning the stream errors out.Expected behavior
As expected and as stated in the doc, the response of an Apollo Query differs depending on the
errorPolicy
setting:errorPolicy: none
the stream errors out, providing an error message, but no data.errorPolicy: ignore
the stream nexts, while providingdata
object but noerrors
array, and completeserrorPolicy: all
the stream nexts, while providingdata
anderrors
array, and completesExactly this behaviour is expected for Apollo Subscriptions. Instead, however, the following behaviour is seen here:
errorPolicy: none
the stream errors out, providing an error message, but no data.errorPolicy: ignore
the stream errors out, providing an error message, but no data.errorPolicy: all
the stream errors out, providing an error message, but no data.Any change of the
errorPolicy
does nothing to the response.Environment