NewRelic and Error logging with Apollo GraphQL on iOS


We use NewRelic iOS SDK to track metrics and HTTP errors. However, the automatic SDK logging is not working with GraphQL network errors (using the Apollo GraphQL SDK). Is there any recommended approach to handle this?


By design, GraphQL sets a 200 success code on requests even if there are errors in the request. As a result, the mobile app receives 200 OK responses with an error object in the response (if error occurs). Since the response body is captured on MobileRequestError event and not MobileRequest, this presents a limitation in graphQL request error analysis.

The advised way to accomplish capturing the response body of a graphQL call is to create a custom mobile event for 200 requests that have an error in the response body. The iOS agent would then be able to track and push those events to Insights.

(Additional info: Add Custom Data)