Skip to content

[Next.js] Custom Error instanceof check fails in beforeSend hook on Server Component #18277

@developer-choi

Description

@developer-choi

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

8

Framework Version

Nextjs 14.2.4

Link to Sentry event

https://choeyujin.sentry.io/issues/7050074435/?query=is%3Aunresolved&referrer=issue-stream

Reproduction Example/SDK Setup

https://github.com/developer-choi/reproduce-sentry-instanceof-2025-11-21

Steps to Reproduce

https://github.com/developer-choi/reproduce-sentry-instanceof-2025-11-21?tab=readme-ov-file#reproduction-steps

Expected Result

=== Step 1: Server Component catch block ===
instanceof CustomApiError: true ✅

=== Step 2: beforeSend ===
instanceof CustomApiError: true ✅

Actual Result

=== Step 1: Server Component catch block ===
instanceof CustomApiError: true ✅

=== Step 2: beforeSend ===
instanceof CustomApiError: false ❌

Additional Context

Unfortunately, due to production constraints, I cannot upgrade to the latest Sentry version yet. This error is occurring in version 8

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions