GraphQL Middleware plugin for Sentry.
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({
dns: SENTRY_DNS
})
const server = GraphQLServer({
typeDefs,
resolvers,
middlewares: [sentryMiddleware]
})
serve.start(() => `Server running on http://localhost:4000`)
export interface Options {
dsn: string
config?: ConstructorOptions
}
function sentry(options: Options): IMiddlewareFunction
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. |
This project is licensed under the MIT License.