Skip to content

captureException not working in Next.js/Vercel Edge Runtime #9626

@roch-numbered

Description

@roch-numbered

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

7.81.1

Framework Version

Next.js 14.0.3 + React 18

Link to Sentry event

No response

SDK Setup

sentry.edge.config.ts

Sentry.init({
  dsn: SENTRY_DSN,

  // Adjust this value in production, or use tracesSampler for greater control
  tracesSampleRate: 1,

  // Setting this option to true will print useful information to the console while you're setting up Sentry.
  debug: false,
});

sentry.server.config.ts

Sentry.init({
  dsn: SENTRY_DSN,

  // Adjust this value in production, or use tracesSampler for greater control
  tracesSampleRate: 1,

  // Setting this option to true will print useful information to the console while you're setting up Sentry.
  debug: false,
});

Steps to Reproduce

  1. On an Edge Runtime that responses with a ReadableStream.
  2. Call captureException() after a promise.

Expected Result

Exceptions should be captured whatever the environment and the response type.

Actual Result

The exception is never captured to Sentry's dashboard.


When using Data Streaming from Next.js and Vercel in an Edge Runtime, it seems impossible to capture anything to Sentry after a promise is called. This bug isn't reproducible in NodeJS Runtime.

You can find a reproduction with instructions on setup here: https://github.com/roch-numbered/nextjs-stream

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nextjsIssues related to the Sentry Nextjs SDK

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions