@apollo/client 3.6.9 with graphql 15.8.0 broken on Webkit (Safari) ServerParseError

I have a React TS application that uses graphql as a middleware between the react app and our API layer. Yesterday we started getting reports that the application was not displaying data on Safari for Mac and iOS. Additionally, our React-Native web view app was also not working(to be expected as it would be the same as viewing the website on Safari). The graphql queries are returning the data but we are seeing ServerParseError Error: JSON Parse error: Unexpected identifier “object” in the console. We traced the issue to results from useQuery. It appears as though the loading status from useQuery will switch to false before the data is actually stored in the data response. Setting a breakpoint on the result will cause it to work properly. Any help with how to fix this issue would be greatly appreciated!

Want to emphasis this issue is only occurring on Webkit-based browsers such as Safari. It works as expected on Chrome and Firefox.

Hey @kyle.mayor, would you please share a reproduction of the problem and open an issue on the apollo-client repo?

Hi Trevor,

Thank you for reaching out. This issue is in a proprietary application. I will try to replicate it in a non-proprietary setup to share here. In the meantime, the stack is a React TS front end utilizing Apollo Clint 3.6.9 and graphql 15.8 to make requests to a sweet of APIs. The data returns from the graphql requests but Apollo Client is throwing a ServerParseError. When I get something sharable I will post it here.

Hey, I experienced the same issue in my Gatsby + Wordpress Grapql Application when calling the server, only an issue in Safari - not an issue in any other Browser. Somehow the response is not detected as JSON:

The request shows it is application/json + valid json data.

@kyle.mayor - have you been able to get more info, there is very little available on the internet.

@Flobauer, we got a temporary workaround by swapping ApolloClient with Graphql-hooks. I opened a ticket to Apollo and they have suggested that the problem for us may be whatwg-fetch. We are working on swapping that out for the equivalent used by graphql-hooks to see if that restores use with apollo client. Swapping to graphql-hooks is not a one-to-one swap so we are hoping this allows us to go back to using apollo client.

We got a full fix. With advice from Apollo support, we switched out whatwg-fetch for isomorphic-fetch. This allowed us to return to full functionality on Safari/iOS and maintain functionality on Chrome and Firefox.