Skip to content

Nuxt: report errors caught by <NuxtErrorBoundary> during SSR #26795

Done

Description

@adamkasper

Problem Statement

Nuxt 4.7 added SSR support to <NuxtErrorBoundary> (experimental.ssrErrorBoundary). An error a boundary catches during SSR is rendered as its #error slot, and the page returns 200.

These errors don't reach Sentry:

  • On the server, @sentry/nuxt reports errors from Nitro's error hook. A caught error never reaches it.
  • @sentry/nuxt listens to vue:error only in its client plugin (runtime/plugins/sentry.client.js). The boundary does call vue:error on the server, but nothing on the server listens to it.
  • On the client, the boundary restores the error from the payload without calling vue:error.

A broken widget can therefore fail on every SSR request without a single event in Sentry.

Solution Brainstorm

Report errors caught by <NuxtErrorBoundary> during SSR. One way: a server-side Nuxt app plugin that listens to vue:error and captures the error, except when the render ends on the error page (nuxtApp.payload.error). The Nitro error hook already reports that one.

What we run for now:

import { captureException } from '@sentry/nuxt'

export default defineNuxtPlugin((nuxtApp) => {
  const caught: unknown[] = []

  nuxtApp.hook('vue:error', (error) => {
    caught.push(error)
  })

  nuxtApp.hook('app:rendered', () => {
    if (nuxtApp.payload.error)
      return

    for (const error of caught)
      captureException(error)
  })
})

Additional Context

Activity

  1. linear-code commented on Nov 24, 2026

    @linear-code
  2. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Nov 24, 2026
  3. pranav514 commented on Nov 24, 2026

    @pranav514
    Contributor

    Hi @Lms24 @adamkasper @chargome
    I saw this issue and would love to pick it up if it’s not already claimed internally.

    The server-side Nuxt plugin approach (vue:error + app:rendered hook check) looks very clean. If you're open to an external PR, please let me know and I'll put together a draft PR with tests. Otherwise, happy to let the internal team take it!

  4. JPeer264 commented on Nov 24, 2026

    @JPeer264
    Member

    @pranav514 I saw that you also showed interest in another ticket, which might take some time. If you want you can work on it, but I strongly recommend to focus on one ticket at once to achieve the quality we're aiming for (and to keep review cycles as low as possible).

  5. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Nov 24, 2026
  6. pranav514 commented on Nov 24, 2026

    @pranav514
    Contributor

    @JPeer264 I wanted to work on this issue first, as #26502 May take some time, so I wanted to close this issue first.

  7. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Nov 24, 2026
  8. pranav514 commented on Nov 24, 2026

    @pranav514
    Contributor

    @JPeer264 I have create the PR that fixes this issue, please do review it so that we can move forward

  9. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Nov 24, 2026
  10. added a commit that references this issue on Nov 25, 2026
    a1fd756
  11. github-actions commented on Nov 25, 2026

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #26815, which was included in the 11.18.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions