Skip to content

How to setup error monitoring (Sentry / Bugsnag etc) #8928

Closed Answered by asgeo1
asgeo1 asked this question in Questions
Discussion options

You must be logged in to vote

This appears to work for me

// sentryPlugin.ts

// Based on https://github.com/pointblankdev/apollo-plugin-sentry/blob/master/src/index.ts

import * as Sentry from '@sentry/node';
import { ApolloServerPlugin } from '@apollo/server';
import type { Context } from '.keystone/types';

const sentryPlugin = (name?: string): ApolloServerPlugin<Context> => {
  return {
    // request lifecycle events
    async requestDidStart() {
      /* Within this returned object, define functions that respond
           to request-specific lifecycle events. */
      return {
        async didEncounterErrors(ctx) {
          // If we couldn't parse the operation (usually invalid queries, not necessary?)
          

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@asgeo1
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by asgeo1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants