Skip to content

Releases: jungsoft/apollo-sentry-helper

2.0.4

28 Aug 22:52
Compare
Choose a tag to compare

💅 Improvements

  • 💅 Updated dependencies

2.0.3

14 Aug 19:54
Compare
Choose a tag to compare

💅 Improvements

  • 💅 Accept type ApolloError on getErrorsList and getErrorMessage

2.0.2

14 Aug 19:10
Compare
Choose a tag to compare

💅 Improvements

  • 💅 New exports! All types are now exported by default.

2.0.0

07 Aug 21:50
Compare
Choose a tag to compare

🔥 Migrated to Apollo Client v3

apollo-sentry-helper has migrated to Apollo Client v3!

You can read all the good news here, and check out how to migrate your project here.

We're still supporting older projects, though! Currently, there are two tags on the NPM package: latest and next.

  • latest: Uses apollo-link-error, is compatible with Apollo Client 2.
  • next: Uses @apollo/client/link/error, is compatible with Apollo Client 3.

So, in order to setup apollo-sentry-helper into your project:

Apollo Client 3

# With npm
npm install apollo-sentry-helper@next

# With yarn
yarn add apollo-sentry-helper@next

Apollo Client 2

# With npm
npm install apollo-sentry-helper

# With yarn
yarn add apollo-sentry-helper

1.1.0

24 Jul 15:35
Compare
Choose a tag to compare

🔥 Initial stable release

This package provides a new link to connect Sentry with Apollo Client, in order to automatically report GraphQL errors to Sentry in a meaningful way.

Usage

Initialize Sentry as you would normally. Then, build the error link with your settings and add it to your Apollo Client's link array:

import { buildSentryErrorLink } from "apollo-sentry-helper";

const sentryErrorLink = buildSentryErrorLink();

const client = new ApolloClient({
  cache: new InMemoryCache(),
  link: ApolloLink.from([
    // Other links here
    sentryErrorLink,
  ]),
});

Options

You can customize what is going to be included in the error report, and which errors should be reported.

const sentryErrorLink = buildSentryErrorLink({
  // Defines if the operation body is going to be included in the error report.
  // Defaults to true.
  includeBody: true,

  // Defines if the response is going to be included in the error report.
  // Defaults to true.
  includeResponse: true,

  // Defines if variables are going to be included in the error report.
  // Defaults to true.
  includeVariables: true,

  // Allows the user to filter errors that should be included in the error report.

  // By default errors will only be reported if there was a network error, or if
  // the operation hasn't returned any data, meaning that the server processed the request,
  // but it was invalid. You can override this behavior by setting the "filter" option.
  filter: (error: ErrorResponse) => boolean,
});