Skip to content

@sentry/remix exports ErrorBoundary in its types but it is only present in the browser, not in node #16298

Closed
@tmcw

Description

@tmcw

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/remix

SDK Version

9.18.0

Framework Version

Remix 2.16.5

Link to Sentry event

No response

Reproduction Example/SDK Setup

import { ErrorBoundary } from "@sentry/remix";

Steps to Reproduce

  1. Import and use ErrorBoundary from @sentry/remix
  2. Use remix

Expected Result

The ErrorBoundary component is available in both client and SSR contexts, the same as it was in Sentry 8.x

Actual Result

ErrorBoundary is not exported when you're in a node.js environment because of the different entrypoint, and so you fail in prod without a TypeScript error.

This is a pretty tricky way to handle typescript exports: I would sort of understand if there were entrypoints like @sentry/remix/client and @sentry/remix/node, but given that it's one package you import, the types are kind of "lying" about what's actually available: I write isomorphic code as if ErrorBoundary exists, but it only exists in one environment (the browser) and crashes the other (node).

This change also is, afaict, not mentioned in the 9.x release notes: https://github.com/getsentry/sentry-javascript/releases/tag/9.0.0 or the migration guide: https://docs.sentry.io/platforms/javascript/guides/remix/migration/v8-to-v9/

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions