bugsnag-js
bugsnag-js copied to clipboard
Add plugin package for Fastify server
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/
Hi @jgeschwendt - thanks for your feedback. This is something which is on our roadmap and we hope to implement in the future.
@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()
})
+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!
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 🙂
+1 from us for this