Skip to content

sentry-expo-upload-sourcemaps fails when plugin is registered as '@sentry/react-native' instead of '@sentry/react-native/expo' #6538

Description

@ihor-sviziev

Environment

What React Native libraries do you use?
Expo Application Services (EAS), Expo (mobile only), Hermes, RN New Architecture

Are you using sentry.io or on-premise?
sentry.io (SaaS)

Are you using any other error monitoring solution alongside Sentry?
No

@sentry/react-native SDK Version

7.11.0

How does your development environment look like?

expo: ~56.0.17
react-native: 0.85.3
New Architecture: enabled (default since SDK 53)
EAS: yes (EAS Update for OTA)

Sentry.init()

Sentry.init({
  dsn: '...',
  // standard config
});

Steps to Reproduce

  1. Register the Sentry plugin in app.config.ts using the bare package name (which the official docs say is valid):
    plugins: [
      [
        "@sentry/react-native",
        {
          organization: "my-org",
          project: "my-project"
        }
      ]
    ]
  2. Run eas update to publish an OTA update (generates dist/ with bundles and source maps).
  3. Run npx sentry-expo-upload-sourcemaps dist.

Expected Result

Source maps are uploaded to Sentry successfully. The official docs state:

"Both @sentry/react-native and @sentry/react-native/expo are valid plugin paths. Expo resolves them the same way."

Actual Result

🐕 Fetching from expo config...
Could not fetch '@sentry/react-native' plugin properties from expo config.
Error: Process completed with exit code 1.

Root Cause

In node_modules/@sentry/react-native/scripts/expo-upload-sourcemaps.js, the plugin lookup hardcodes the /expo suffix:

// line 31
return pluginName === '@sentry/react-native/expo';

So when the plugin is registered as '@sentry/react-native' (without /expo), sentryPlugin is undefined, pluginConfig is null, and the script exits with code 1.

Fix: Change the lookup to also match '@sentry/react-native':

return pluginName === '@sentry/react-native/expo' || pluginName === '@sentry/react-native';

Or use a helper like pluginName.startsWith('@sentry/react-native').

Workaround

Either register the plugin as '@sentry/react-native/expo' in app.config.ts, or pass SENTRY_ORG and SENTRY_PROJECT as environment variables (which bypasses the expo config lookup entirely).

Metadata

Metadata

Assignees

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions