Skip to content

flesch/graphql-middleware-sentry

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 https://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.

About

🗃 A GraphQL Middleware plugin for Sentry.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%