Haegin / apollo-sentry-link

An Apollo Link to record GraphQL queries as Sentry breadcrumbs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Apollo Sentry Link

A simple Apollo Link to record GraphQL queries as breadcrumbs in Sentry to aid debugging.

Behaviour

When added to an Apollo Client this will log GraphQL requests as they are made as breadcrumbs in Sentry. It records the query name, type (query or mutation) and the names of any fragments used.

In development this information is logged to the console instead.

Usage

Add the link to your Apollo Client.

import ApolloSentryLink from 'apollo-sentry-link'

...

const client = new ApolloClient({
  link: ApolloLink.from([
    ApolloSentryLink,
    createHttpLink({ uri: "/graphql" })
  ]),
})

About

An Apollo Link to record GraphQL queries as Sentry breadcrumbs


Languages

Language:JavaScript 100.0%