1.0.0 • Published 6 years ago

graphql-middleware-rollbar v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

GraphQL Middleware for Rollbar

Drop in middleware for GraphQL-Yoga that catches and publishes non-schema-related (i.e., resolver-level) errors to your Rollbar service.

If you haven't yet created a Rollbar account for your project(s), you will need to sign up.

npm install graphql-middleware-rollbar

Then, include the following when instantiating your graphql-yoga server like:

import { rollbar } from 'graphql-middleware-rollbar'

const rollbarMiddleware = rollbar({
    rollbarAccessToken: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX' // REPLACE WITH YOUR ROLLBAR API KEY
    })
...

const server = new GraphQLServer({
    ...
    middlewares: [rollbarMiddleware],
    ...
})

server.start(() => console.log('All my resolver-level errors are being reported to Rollbar!'))