🗃 A GraphQL Middleware plugin for Sentry.
Clone or download
Pull request Compare This branch is even with maticzav:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.circleci
src
.gitignore
.prettierrc
LICENSE.md
README.md
package.json
renovate.json
tsconfig.json
tslint.json
yarn.lock

README.md

graphql-middleware-sentry

CircleCI npm version

GraphQL Middleware plugin for Sentry.

Usage

With GraphQL Yoga

import { GraphQLServer } from 'graphql-yoga'
import { sentry } from 'graphql-middleware-sentry'

const typeDefs = `
  type Query {
    hello: String!
    bug: String!
  }
`

const resolvers = {
  Query: {
    hello: () => `Hey there!`
    bug: () => {
      throw new Error(`Many bugs!`)
    }
  }
}

const sentryMiddleware = sentry({
  dsn: SENTRY_DSN
})

const server = GraphQLServer({
  typeDefs,
  resolvers,
  middlewares: [sentryMiddleware]
})

serve.start(() => `Server running on http://localhost:4000`)

API & Configuration

export interface Options {
  dsn: string
  config?: ConstructorOptions
  forwardErrors?: boolean
}

function sentry(options: Options): IMiddlewareFunction

Options

property required description
dsn true Your Sentry DSN
config false A config object for Raven
forwardErrors false Should middleware forward errors to the client or block them.

License

This project is licensed under the MIT License.