@honeybadger-io/nextjs
v5.9.8
Published
Next.js integration for Honeybadger
Downloads
8,966
Readme
Honeybadger Next.js Integration
Documentation and Support
For comprehensive documentation and support, check out our documentation site.
The documentation includes a detailed Next.js integration guide.
Project Goals
The goal is to provide an idiomatic, simple integration of Honeybadger's exception monitoring service with Next.js applications.
Project Status
This version is considered suitable for preview.
Features
- Automatic reporting of uncaught exceptions (see Limitations)
- Breadcrumbs
- Source map upload to Honeybadger
- CLI command to generate Honeybadger configuration files for Next.js runtimes
Limitations
The following limitations are known to exist and will be tackled in future releases:
- Issue link: A custom error component is used to report uncaught exceptions to Honeybadger.
This is necessary because Next.js does not provide a way to hook into the error handler.
This is not a catch-all errors solution.
If you are using the Pages Router, there are some caveats to this approach, as reported here. This is a limitation of Next.js, not Honeybadger's Next.js integration. Errors thrown in middlewares or API routes will not be reported to Honeybadger, since when they reach the error component, the response status code is 404 and no error information is available. Additionally, there is an open issue about 404 being reported with Next.js apps deployed on Vercel, when they should be reported as 500.
If you are using the App Router, these limitations do not apply, because errors thrown in middlewares or API routes do not reach the custom error component but are caught by the globalwindow.onerror
handler. However, some other server errors (i.e. from data fetching methods) will be reported with minimal information, since Next.js will send a generic error message to this component for better security. - Issue link: Source maps for the Edge runtime are not supported yet.
Example app
A separate repository, nextjs-with-honeybadger exists with an example app using this package. Follow the README instructions to run the example app.
Development
# install dependencies
npm install
# build for production
npm run build
License
This package is MIT licensed. See the MIT-LICENSE file in this folder for details.