bugsnag-js icon indicating copy to clipboard operation
bugsnag-js copied to clipboard

Add plugin package for Fastify server

Open jgeschwendt opened this issue 5 years ago • 5 comments

Feature Request:

It would be awesome if there was an official plugin to support Fastify servers; specifically version 3.x where Express middleware is no longer supported out of the box.

https://www.fastify.io/

jgeschwendt avatar Aug 19 '20 13:08 jgeschwendt

Hi @jgeschwendt - thanks for your feedback. This is something which is on our roadmap and we hope to implement in the future.

abigailbramble avatar Aug 19 '20 14:08 abigailbramble

@jgeschwendt, you can use fasify hooks to integrate Bugsnag:

const Bugsnag = require('@bugsnag/js')
Bugsnag.start({ apiKey: <your api key> })

fastify.addHook('onError', (request, reply, error, done) => {
  // Only send Bugsnag errors when not in development
  if (process.env.NODE_ENV !== 'development') {
    Bugsnag.notify(error)
  }
  done()
})

ldaume avatar Nov 19 '20 11:11 ldaume

+1 for this feature request

I've used a similar approach to @ldaume to get something up and running – adding request data to get the request tab populated:

fastify.addHook('onError', async (request, reply, error) => {
  Bugsnag.notify(error, (event) => {
    event.request = {
      headers: request.headers,
      httpMethod: request.method,
      url: request.url,
      referer: request.referer
    }
  })
})

However, it would be great to have an official integration that supports session tracking so that I can get a stability score!

bengourley avatar Oct 11 '21 10:10 bengourley

Hi @bengourley! 👋🏾

Thanks for sharing your approach! I'm afraid we don't yet have a firm timeframe for when official support will be added, but we've flagged your interest in this with the product team 🙂

yousif-bugsnag avatar Oct 11 '21 15:10 yousif-bugsnag

+1 from us for this

bndrgroup avatar Oct 12 '21 14:10 bndrgroup