最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Sentry not uploading the sourcemaps automatically in expo react native - Stack Overflow

programmeradmin2浏览0评论

I am having expo react native application which has ios and android folders prebuilt in the source code. I having some configuration done in the native projects and hence it's available in the source code.

I integrated Sentry as per the documentation, and it records any crashing events in Sentry without any issue. But however, when I create a release build locally or through EAS build, though the crash events are getting recorded, the stack trace is obfuscated and I see the source maps are not uploaded. In Sentry it says

No Uploaded Artifacts The release this event belongs to doesn't have any uploaded artifacts. Upload your build artifacts to Sentry using the release:

No Debug ID Tooling Used This event doesn't contain any Debug IDs. Read the Sentry Source Maps Documentation to learn how to inject Debug IDs into your build artifacts and how to upload them to Sentry.

But as the docs suggested I have added the SENTRY_AUTH_TOKEN to EAS environment variables. Unfortunately, when I go to Sentry settings and check the access tokens, i see the access token has been never accessed which is bit troubling.

This is how I have setup sentry

In the RootLayout file I added

Sentry.init({
  dsn: 'dsn',

  // uncomment the line below to enable Spotlight ()
  // spotlight: __DEV__,
});

Then wrapped it

export const RootLayout = Sentry.wrap(Layout);

In app.json I added

"plugins": [
      [
        "@sentry/react-native/expo",
        {
          "url": "/",
          "project": "<<project-name>>",
          "anization": "<<company-name>>"
        }
      ]
    ]

However there are no artifacts uploaded in sentry. Any assistance would be greatly appreciated.

I am having expo react native application which has ios and android folders prebuilt in the source code. I having some configuration done in the native projects and hence it's available in the source code.

I integrated Sentry as per the documentation, and it records any crashing events in Sentry without any issue. But however, when I create a release build locally or through EAS build, though the crash events are getting recorded, the stack trace is obfuscated and I see the source maps are not uploaded. In Sentry it says

No Uploaded Artifacts The release this event belongs to doesn't have any uploaded artifacts. Upload your build artifacts to Sentry using the release:

No Debug ID Tooling Used This event doesn't contain any Debug IDs. Read the Sentry Source Maps Documentation to learn how to inject Debug IDs into your build artifacts and how to upload them to Sentry.

But as the docs suggested I have added the SENTRY_AUTH_TOKEN to EAS environment variables. Unfortunately, when I go to Sentry settings and check the access tokens, i see the access token has been never accessed which is bit troubling.

This is how I have setup sentry

In the RootLayout file I added

Sentry.init({
  dsn: 'dsn',

  // uncomment the line below to enable Spotlight (https://spotlightjs)
  // spotlight: __DEV__,
});

Then wrapped it

export const RootLayout = Sentry.wrap(Layout);

In app.json I added

"plugins": [
      [
        "@sentry/react-native/expo",
        {
          "url": "https://sentry.io/",
          "project": "<<project-name>>",
          "anization": "<<company-name>>"
        }
      ]
    ]

However there are no artifacts uploaded in sentry. Any assistance would be greatly appreciated.

Share Improve this question asked Mar 7 at 6:19 SVGSVG 9247 silver badges30 bronze badges 1
  • Are you building your expo app with eas using the local flag or in the cloud? As the SENTRY_AUTH_TOKEN is probably stored as secret it's not available locally if you didn't declare it in your .env file again. – Mo W. Commented Mar 7 at 18:05
Add a comment  | 

1 Answer 1

Reset to default 0

Based on the described behaviour of missing Debug IDs and having some native code changes, I believe the issue is in the following:

  1. Ensure that your project is using the Sentry Metro Plugin in metro.config.js, this automatically enables Debug IDs:
// const { getDefaultConfig } = require("expo/metro-config");
const { getSentryExpoConfig } = require("@sentry/react-native/metro");
// const config = getDefaultConfig(__dirname);
const config = getSentryExpoConfig(__dirname);
module.exports = config;

More information at https://docs.sentry.io/platforms/react-native/manual-setup/expo/#add-sentry-metro-plugin


  1. Ensure the prebuilt native code is up to date. The Sentry Expo Plugin (@sentry/react-native/expo) adds the automatic upload scripts to the Xcode Build Phases and to the build.gradle. Below you can see examples of the updated code.

The Xcode Build Phase Bundle React Native code and images last line should look like this (executing the sentry-xcode.sh script):

/bin/sh `"$NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode.sh'"` `"$NODE_BINARY" --print "require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'"`

The app/build.gradle should apply the sentry.gradle:

apply from: new File(["node", "--print", "require('path').dirname(require.resolve('@sentry/react-native/package.json'))"].execute().text.trim(), "sentry.gradle")

More information at https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#configure-automatic-source-maps-upload and https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#enable-gradle-integration

发布评论

评论列表(0)

  1. 暂无评论