Skip to content

🐞 Source map upload fails in EAS Build with "Invalid org token (http status: 401)" despite SENTRY_AUTH_TOKEN being set #4943

@axmav

Description

@axmav

What React Native libraries do you use?

Expo Router, Expo (mobile only), Expo Application Services (EAS)

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

6.15.1

How does your development environment look like?

Expo SDK 53
React Native 0.79.4
Platform: iOS (EAS Build)
Build System: EAS Build (Expo Application Services)
Continuous Native Generation (CNG)

Sentry.init()

Sentry.init({
  dsn: process.env.EXPO_PUBLIC_SENTRY_DSN,
  debug: false,
  enabled: !__DEV__,
  environment: process.env.NODE_ENV ?? 'development',
  tracesSampleRate: 1.0,
  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1.0
})

// Expo-specific configuration as per migration guide
Sentry.setExtras({
  manifest: Updates.manifest,
  deviceYearClass: Device.deviceYearClass
})

Sentry.setTag('expoChannel', Updates.channel)
Sentry.setTag('appVersion', Application.nativeApplicationVersion)

Steps to Reproduce

  1. Set up @sentry/react-native/expo plugin in app.json:
{
  "plugins": [
    [
      "@sentry/react-native/expo",
      {
        "url": "https://sentry.io/",
        "project": "expoapp",
        "organization": "jamie-v5",
        "setCommits": true,
        "uploadSourceMaps": true
      }
    ]
  ]
}
  1. Create SENTRY_AUTH_TOKEN environment variable in EAS
    eas env:create --scope project --name SENTRY_AUTH_TOKEN --value "sntrys_..." --type secret
  2. Configure build profiles in eas.json with explicit environments:
{
  "build": {
    "preview": {
      "environment": "preview",
      "distribution": "internal",
      "autoIncrement": true,
      "channel": "preview"
    }
  }
}
  1. Trigger EAS Build:
    eas build --platform ios --profile preview

Expected Result

  • Source maps should be uploaded to Sentry successfully
  • Build should complete without Sentry-related errors

Actual Result

❌ sentry-cli - To disable source maps auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true

❌ sentry-cli - WARN Failed to load .env file: Failed to load custom .env file: /Users/expo/workingdir/build/expo-app/ios/../.env.sentry-build-plugin

❌ API request failed
❌ Invalid org token (http status: 401)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions