import Link from 'next/link' const Index = () => (

Bugsnag next.js Example

This example demonstrates how to record exceptions in your code with Bugsnag. There are several scenario pages below that result in various kinds of unhandled and handled exceptions.

Important: exceptions in development mode take a different path than in production. These scenarios should be run on a production build (i.e. 'next build').{' '} Read more

  1. API route exceptions
    1. API has a top-of-module Promise that rejects, but its result is not awaited.{' '} Open in a new tab
    2. API has a top-of-module exception. Open in a new tab
    3. API has has an exception in its request handler.{' '} Open in a new tab
    4. API uses a try/catch to handle an exception and records it.{' '} Open in a new tab
  2. SSR exceptions
    1. getServerSideProps throws an Error. Open in a new tab {' '} or{' '} Perform client side navigation
    2. getServerSideProps returns a Promise that rejects. Open in a new tab
    3. getServerSideProps calls a Promise that rejects, but does not handle the rejection or await its result (returning synchronously). Open in a new tab
    4. getServerSideProps manually captures an exception from a try/catch. {' '} Open in a new tab
  3. Client exceptions
    1. There is a top-of-module Promise that rejects, but its result is not awaited.{' '} Perform client side navigation {' '} or{' '} Open in a new tab
    2. There is a top-of-module exception. _error.js should render.{' '} Perform client side navigation {' '} or{' '} Open in a new tab
    3. There is an exception during React lifecycle that is caught by Next.js's React Error Boundary. In this case, when the component mounts. This should cause _error.js to render.{' '} Perform client side navigation {' '} or{' '} Open in a new tab
    4. There is an unhandled Promise rejection during React lifecycle. In this case, when the component mounts.{' '} Perform client side navigation {' '} or{' '} Open in a new tab
    5. An Error is thrown from an event handler.{' '} Perform client side navigation {' '} or{' '} Open in a new tab
) export default Index