React Apollo Client Crashlytics

Viewed 10

I have setup a global error for my react-native app. My problem is when I try to use crashlytics I can't seem to find the errors on the firebase console. What I'm lacking on my code below?

const authMiddleWare = new ApolloLink(async (operation, forward) => {
  operation.setContext({
    headers: {
      "X-PQ-App": APP_AUTH,
      "X-PQ-Locale": "en",
      "X-PQ-Authorisation": (await getToken()) || null,
    },
  });

  return forward(operation);
});

const errorLink = onError(({ graphQLErrors, networkError }) => {
  if (graphQLErrors) {
    crashlytics().recordError(graphQLErrors);
  }
  if (networkError) {
    crashlytics().recordError(networkError);
    showToast({
      type: "error",
      title: "Something went wrong",
      message: "Please try again",
    });
  }
});

const httpLink = new HttpLink({
  uri: API_URL,
});

let client = new ApolloClient({
  cache: new InMemoryCache(),
  link: from([authMiddleWare, errorLink, httpLink]),
});
0 Answers
Related