Skip to content

Sentry functions transform into (void 0) when building for remix/cloudflare/hydrogen #15620

Closed
@andrewcohen

Description

@andrewcohen

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.5

Framework Version

Remix 2.11.2

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

  1. In a remix projects server file, or any route file
// app/routes/repro.tsx
import * as Sentry from "@sentry/remix";
Sentry.captureException("test 123")
  1. run build
$ pnpm remix vite:build 
# or 
$ pnpm shopify hydrogen build

You will see a warning

app/routes/repro.tsx (3:7): "captureException" is not exported by "node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]__@open_iuiv3pujvl5pfv746jgqtaej4m/node_modules/@sentry/remix/build/esm/index.client.js", imported by "app/routes/repro.tsx".

We also get similar warnings for startSpan, getTraceData, setContext, setUser

  1. Open dist/server/index.js and search for "test 123" and you will see the captureException compiled away
(void 0)("test 123")

Expected Result

The sentry functions are compiled into the server bundle.

Actual Result

The sentry functions turn into (void 0) and our application becomes unusable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: remixIssues related to the Sentry Remix SDK

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions