3

I cannot display my original code in sentry dashboard.

i get the following errors

Discarded invalid parameter 'type'

Source code was not found for app:///crna-entry.delta? 
platform=ios&dev=true&minify=false`

I've configured the app.json as indicated in the docs.

"hooks": {
  "postPublish": [
    {
      "file": "sentry-expo/upload-sourcemaps",
      "config": {
        "organization": "xxxxx",
        "project": "xxxxxxx",
        "authToken": "xxxxxxxxxx"
      }
    }
  ]
}
John doe
  • 3,680
  • 7
  • 31
  • 65

1 Answers1

0

I answered this question here

First way

If you are using expo. You should use sentry-expo package which you can find here: sentry-expo

Put this hook to your expo json (app.json) file

{
  "expo": {
    "hooks": {
      "postPublish": [
        {
          "file": "sentry-expo/upload-sourcemaps",
          "config": {
            "organization": "<your organization name>",
            "project": "<your project name>",
            "authToken": "<your auth token here>"
          }
        }
      ]
    }
}

  1. organization you can find on here https://sentry.io/settings/ which named "Organization Name"
  2. project enter your project name, you can find here: https://sentry.io/organizations/ORGANIZATION_NAME/projects/
  3. authToken create a authToken with this url https://sentry.io/api/

Then run expo publish, it upload the source maps automatically.

Testing Locally

Make sure that you enabled expo development. add lines;

Sentry.enableInExpoDevelopment = true;
Sentry.config(publicDsn, options).install();

As a Result

On sentry, for only ios, you can able to see the source code where error occured. enter image description here

BUT: unable to see the source code for ANDROID

https://github.com/getsentry/react-native-sentry/issues/372

Second way (manual upload)

Using the api https://docs.sentry.io/platforms/javascript/sourcemaps/

curl -X POST \
  https://sentry.io/api/0/organizations/ORG_NAME/releases/VERSION/files/ \
  -H 'Authorization: Bearer AUTH_TOKEN' \
  -H 'content-type: multipart/form-data' \
  -F file=@script.min.js.map \
  -F 'name=~/scripts/script.min.js.map'
Fatih Turgut
  • 319
  • 3
  • 9