getsentry / sentry-react-native

Official Sentry SDK for React Native
https://sentry.io
MIT License
1.57k stars 337 forks source link

CodePush iOS/Android with Hermes showing wrong line numbers RN0.68/Sentry SDK7/Self-Hosted 22.5.0 #2372

Closed kopax-polyconseil closed 2 years ago

kopax-polyconseil commented 2 years ago

OS:

Platform:

SDK:

{
  "dependencies": {
    "react-native": "^0.68.2",
    "@sentry/react": "^7.6.0",
    "@sentry/react-native": "^4.1.2",
    "@sentry/tracing": "^7.6.0"
  },
  "devDependencies": {
    "@sentry/types": "^7.6.0",
    "@sentry/webpack-plugin": "^1.18.9"
  }
}

react-native version: 0.68.2

Are you using Expo?

Are you using sentry.io or on-premise?

If you are using sentry.io, please post a link to your issue so we can take a look:

NA

Configuration:

import { Platform } from 'react-native'
import CodePush from 'react-native-code-push'

import { env } from 'libs/environment'

import { version, build } from '../../../package.json'

export async function getSentryConfig() {
  let update
  try {
    update = await CodePush.getUpdateMetadata()
  } catch (error) {
    // silent fail
  }

  let release = `${version}-${Platform.OS}`
  if (update) {
    release += `+codepush:${update.label}`
  }
  const dist = `${build}-${Platform.OS}`
  return {
    dsn: env.SENTRY_DSN,
    environment: env.ENV,
    release,
    dist,
  }
}

I have following issue:

Following https://github.com/getsentry/sentry-react-native/issues/2244 and https://github.com/getsentry/sentry-react-native/issues/2087 closed too early, this is how we generate the sourcemaps, we used all of your recommendations, but still can't use source map with Android/iOS app after code push, which we often use.

iOS hard and android Hard work fine since your last investigation regarding iOS and Android matter, but this is what code push does.

Steps to reproduce: :

Actual result:

iOS

image image

Android

image image

Expected result:

We expect to see proper sourcemaps line as for our iOS and Android hard build

bruno-garcia commented 2 years ago

Thanks for raising. There has been some changes recently in Hermes, that might be the cause. We'll need to look into this before we can get back to you.

kopax-polyconseil commented 2 years ago

Thanks for your reply, I though after closing my first issue and another that Code Push should now be fixed, I must have misunderstood.

Could you please share where can I find the information of when was introduced those Hermes change?

FYI, it never used to work with manual sourcemaps upload, perhaps because the iOS and Android build step for manual source maps upload where wrong until recently.

marandaneto commented 2 years ago

@kopax-polyconseil if you are using Hermes and manually uploading source maps, everything should work out. The docs are up to date for that scenario. About Code Push, can you share your code snippets on how you init the Sentry SDK, the CodePush SDK and the uploading scripts for Sentry and Code Push?

kopax-polyconseil commented 2 years ago

everything should work out

Could you please share what version did you test ?

The docs are up to date for that scenario.

I think the code push and hard build source maps generation step are the same, also if I am correct, the only way to use code push and sourcemaps is through manual sourcemaps upload, so I don't get what you are actually digging on.

Can you please clarify where can I find the doc for code push AND hermes to see if they are difference between the two?

About Code Push, can you share your code snippets

I did share previously a working minimal reproduction that you can build on your end, but I will also add snippets below, if you need to clarify dont hesitate to ask for more details of any part, this as been a big pain for our team to debug without the sourcemaps and we are commited to participate to this problem resolution.

init the Sentry SDK

the CodePush SDK

the uploading scripts for Sentry and Code Push

marandaneto commented 2 years ago

@kopax-polyconseil there are no docs for Hermes and CodePush, they are different things that can be used together. If you want to manually generate source maps for Hermes, Follow the docs. If you want to use CodePush, Follow the docs. The most important part here is that release and dist should match.

I still don't have your code push scripts, when do you call the appcenter CLI and with which parameters? Also, instead of using sentry-cli releases, you should follow the CodePush docs and use the sentry-cli react-native appcenter commands with the correct parameters.

kopax-polyconseil commented 2 years ago

there are no docs for Hermes and CodePush, they are different things that can be used together.

Ok

If you want to manually generate source maps for Hermes, Follow the docs.

According to your first point, and that we already configured with your help and with success both iOS and Android sourcemaps, it shouldn't be necessary, we can re-use the same method.

If you want to use CodePush, Follow the docs.

We already use CodePush, bundle are created during CI, for example:

The most important part here is that release and dist should match.

As you have already seen in the first snippet within the description of the issue, this is not what we do, release is not strictly equal to dist during a code push, I am going to change that.

But isn't it weird that we still see "wrong" sourcemap? Also, the CodePush documentation doesn't show release and dist should match, for example, this snippet:

import codePush from "react-native-code-push";

codePush.getUpdateMetadata().then(update => {
  if (update) {
    Sentry.init({
      // ...
      release: `${update.appVersion}+codepush:${update.label}`,
      dist: update.label,
    });
  }
});

Also, instead of using sentry-cli releases, you should follow the CodePush docs and use the sentry-cli react-native appcenter commands with the correct parameters.

Thank you, I am having a try

kopax-polyconseil commented 2 years ago

Hello, I am still trying to configure that in this branch:

I get the following error when I run sentry-cli react-native appcenter ...:

  INFO    2022-07-22 16:18:01.164673529 +00:00 Loaded config from /home/circleci/.sentryclirc
  DEBUG   2022-07-22 16:18:01.165184249 +00:00 sentry-cli version: 1.74.4, platform: "linux", architecture: "x86_64"
  INFO    2022-07-22 16:18:01.165190173 +00:00 sentry-cli was invoked with the following command line: "/home/circleci/pass-culture/node_modules/@sentry/cli/sentry-cli" "react-native" "appcenter" "pass-Culture/passculture-testing-android" "android" "./build/CodePush" "--deployment" "CodePush" "--dist" "10197003-android" "--release-name" "1.197.3-+codepush:v2972"
  INFO    2022-07-22 16:18:01.165959311 +00:00 Issuing a command for Organization: sentry Project: application-native
> Fetching latest AppCenter deployment info
error: Failed to load AppCenter deployment history
  caused by: 
  DEBUG   2022-07-22 16:18:02.180226467 +00:00 skipping update nagger because session is not attended

I tried to use this recommendation and set keepalive=false in my .sentryclirc , but it didn't help

Do you have any clue of what's failing here?

marandaneto commented 2 years ago

@kopax-polyconseil You can ignore:

skipping update nagger because session is not attended

The error message is pretty clear:

Issuing a command for Organization: sentry Project: application-native, Fetching latest AppCenter deployment info

Check the given parameters.

kopax-polyconseil commented 2 years ago

@marandaneto

It is not pretty clear ^^, I checked locally and it uploaded the sourcemaps, so I tried using my auth token in the CI, and it seems to be an issue with the auth token used by the CI... no clue why, I need to ask the ops how the CI token was generated.

Within the CI, using my auth token I get the following output:

$ /home/circleci/pass-culture/node_modules/.bin/appcenter codepush release-react --token XXXXXX -d CodePush -a pass-Culture/passculture-staging-android --target-binary-version 1.197.93 --description dropme --disable-duplicate-release-error --sourcemap-output --output-dir ./build
Running "react-native bundle" command:

node node_modules/.bin/react-native bundle --assets-dest build/CodePush --bundle-output build/CodePush/index.android.bundle --dev false --entry-file index.js --platform android --sourcemap-output build/CodePush/index.android.bundle.map
warn Package color-alpha has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /home/circleci/pass-culture/node_modules/color-alpha/package.json
warn Package @types/uuid has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /home/circleci/pass-culture/node_modules/@types/uuid/package.json
warn Package postcss-normalize has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /home/circleci/pass-culture/node_modules/postcss-normalize/package.json
warn Package postcss-preset-env has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /home/circleci/pass-culture/node_modules/postcss-preset-env/package.json
Mapping the following sym linked packages:
{}
Welcome to Metro!
              Fast - Scalable - Integrated

info Writing bundle output to:, build/CodePush/index.android.bundle
info Writing sourcemap output to:, build/CodePush/index.android.bundle.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 27 asset files
info Done copying assets
Converting JS bundle to byte code via Hermes, running command:

node_modules/hermes-engine/linux64-bin/hermesc -emit-binary -out build/CodePush/index.android.bundle.hbc build/CodePush/index.android.bundle -output-source-map -w
node_modules/react-native/scripts/compose-source-maps.js build/CodePush/index.android.bundle.map build/CodePush/index.android.bundle.hbc.map -o build/CodePush/index.android.bundle.map

Releasing update contents to CodePush:

Successfully released an update containing the "build/CodePush" directory to the "CodePush" deployment of the "passculture-staging-android" app.
Done in 36.45s.

circleci@1ebb8e3ce38b:~/pass-culture$ export BUILD=`jq -r .build package.json`; export VERSION=`jq -r .version package.json`; export CODEPUSH_KEY=XXXXXXXXX; export CODE_PUSH_LABEL=$(curl -sS "https://codepush.appcenter.ms/v0.1/public/codepush/update_check?app_version=${VERSION}&deployment_key=${CODEPUSH_KEY}" | jq -r '.update_info.label'); export RELEASE_NAME=${VERSION}-android+codepush:${CODE_PUSH_LABEL};  export DIST=${BUILD}-android; npx sentry-cli "react-native" "appcenter" "pass-Culture/passculture-staging-android" "android" "./build/CodePush" "--deployment" "CodePush" "--dist" "${DIST}" "--release-name" "${RELEASE_NAME}"

  INFO    2022-07-25 10:05:56.488377939 +00:00 Loaded config from /home/circleci/.sentryclirc
  DEBUG   2022-07-25 10:05:56.488442484 +00:00 sentry-cli version: 1.74.4, platform: "linux", architecture: "x86_64"
  INFO    2022-07-25 10:05:56.488453500 +00:00 sentry-cli was invoked with the following command line: "/home/circleci/pass-culture/node_modules/@sentry/cli/sentry-cli" "react-native" "appcenter" "pass-Culture/passculture-staging-android" "android" "./build/CodePush" "--deployment" "CodePush" "--dist" "10197093-android" "--release-name" "1.197.93-android+codepush:v96"
  INFO    2022-07-25 10:05:56.488791010 +00:00 Issuing a command for Organization: sentry Project: application-native
> Fetching latest AppCenter deployment info
> Processing react-native AppCenter sourcemaps
> Analyzing 2 sources
> Analyzing completed in 0.46s
> Rewriting sources
> Rewriting completed in 0.623s
> Adding source map references
  DEBUG   2022-07-25 10:05:59.014752852 +00:00 request POST https://sentry.internal-passculture.app/api/0/projects/sentry/application-native/releases/
  DEBUG   2022-07-25 10:05:59.014781811 +00:00 using token authentication
  DEBUG   2022-07-25 10:05:59.014798448 +00:00 json body: {"version":"1.197.93-android+codepush:v96","projects":["application-native"]}
  DEBUG   2022-07-25 10:05:59.014807400 +00:00 retry number 0, max retries: 0
  DEBUG   2022-07-25 10:05:59.218880755 +00:00 > POST /api/0/projects/sentry/application-native/releases/ HTTP/1.1
  DEBUG   2022-07-25 10:05:59.218911620 +00:00 > Host: sentry.internal-passculture.app
  DEBUG   2022-07-25 10:05:59.218918705 +00:00 > Accept: */*
  DEBUG   2022-07-25 10:05:59.218924722 +00:00 > Connection: TE
  DEBUG   2022-07-25 10:05:59.218930784 +00:00 > TE: gzip
  DEBUG   2022-07-25 10:05:59.218936879 +00:00 > User-Agent: sentry-cli/1.74.4
  DEBUG   2022-07-25 10:05:59.219236600 +00:00 > Authorization: Bearer XXXXX***
  DEBUG   2022-07-25 10:05:59.219248410 +00:00 > Content-Type: application/json
  DEBUG   2022-07-25 10:05:59.219256002 +00:00 > Content-Length: 77
  DEBUG   2022-07-25 10:05:59.440454332 +00:00 < HTTP/1.1 208 Already Reported
  DEBUG   2022-07-25 10:05:59.440501650 +00:00 < Date: Mon, 25 Jul 2022 10:05:59 GMT
  DEBUG   2022-07-25 10:05:59.440520801 +00:00 < Content-Type: application/json
  DEBUG   2022-07-25 10:05:59.440538015 +00:00 < Content-Length: 711
  DEBUG   2022-07-25 10:05:59.440553916 +00:00 < Connection: keep-alive
  DEBUG   2022-07-25 10:05:59.440569546 +00:00 < Allow: GET, POST, HEAD, OPTIONS
  DEBUG   2022-07-25 10:05:59.440586448 +00:00 < Access-Control-Allow-Methods: GET, POST, HEAD, OPTIONS
  DEBUG   2022-07-25 10:05:59.440609730 +00:00 < Access-Control-Allow-Headers: X-Sentry-Auth, X-Requested-With, Origin, Accept, Content-Type, Authentication, Authorization, Content-Encoding
  DEBUG   2022-07-25 10:05:59.440626030 +00:00 < Access-Control-Expose-Headers: X-Sentry-Error, Retry-After
  DEBUG   2022-07-25 10:05:59.440641995 +00:00 < Access-Control-Allow-Origin: *
  DEBUG   2022-07-25 10:05:59.440655324 +00:00 < Vary: Accept-Language, Cookie
  DEBUG   2022-07-25 10:05:59.440669760 +00:00 < Content-Language: en
  DEBUG   2022-07-25 10:05:59.440684001 +00:00 < X-Frame-Options: deny
  DEBUG   2022-07-25 10:05:59.440698551 +00:00 < X-Content-Type-Options: nosniff
  DEBUG   2022-07-25 10:05:59.440713205 +00:00 < X-XSS-Protection: 1; mode=block
  DEBUG   2022-07-25 10:05:59.440725640 +00:00 < Strict-Transport-Security: max-age=15724800; includeSubDomains
  DEBUG   2022-07-25 10:05:59.440755819 +00:00 response status: 208
  DEBUG   2022-07-25 10:05:59.440772035 +00:00 body: {"version":"1.197.93-android+codepush:v96","status":"open","shortVersion":"1.197.93-android+codepush:v96","versionInfo":{"package":null,"version":{"raw":"1.197.93-android+codepush:v96"},"description":"1.197.93-android+codepush:v96","buildHash":null},"ref":null,"url":null,"dateReleased":null,"dateCreated":"2022-07-25T10:03:33.553554Z","data":{},"newGroups":0,"owner":null,"commitCount":0,"lastCommit":null,"deployCount":0,"lastDeploy":null,"authors":[],"projects":[{"id":6,"slug":"application-native","name":"Application Native","newGroups":0,"platform":"react-native","platforms":["node","cocoa","java","javascript","native"],"hasHealthData":false}],"firstEvent":null,"lastEvent":null,"currentProjectMeta":{}}
Uploading sourcemaps for release 1.197.93-android+codepush:v96 distribution 10197093-android
  DEBUG   2022-07-25 10:05:59.452788014 +00:00 request GET https://sentry.internal-passculture.app/api/0/organizations/sentry/chunk-upload/
  DEBUG   2022-07-25 10:05:59.452828158 +00:00 using token authentication
  DEBUG   2022-07-25 10:05:59.452850534 +00:00 retry number 0, max retries: 0
  DEBUG   2022-07-25 10:05:59.453013160 +00:00 > GET /api/0/organizations/sentry/chunk-upload/ HTTP/1.1
  DEBUG   2022-07-25 10:05:59.453029950 +00:00 > Host: sentry.internal-passculture.app
  DEBUG   2022-07-25 10:05:59.453043369 +00:00 > Accept: */*
  DEBUG   2022-07-25 10:05:59.453052973 +00:00 > Connection: TE
  DEBUG   2022-07-25 10:05:59.453062776 +00:00 > TE: gzip
  DEBUG   2022-07-25 10:05:59.453072662 +00:00 > User-Agent: sentry-cli/1.74.4
  DEBUG   2022-07-25 10:05:59.453099947 +00:00 > Authorization: Bearer XXXXX***
  DEBUG   2022-07-25 10:05:59.734030774 +00:00 < HTTP/1.1 200 OK
  DEBUG   2022-07-25 10:05:59.734075808 +00:00 < Date: Mon, 25 Jul 2022 10:05:59 GMT
  DEBUG   2022-07-25 10:05:59.734089460 +00:00 < Content-Type: application/json
  DEBUG   2022-07-25 10:05:59.734101496 +00:00 < Content-Length: 272
  DEBUG   2022-07-25 10:05:59.734114934 +00:00 < Connection: keep-alive
  DEBUG   2022-07-25 10:05:59.734131066 +00:00 < Allow: GET, POST, HEAD, OPTIONS
  DEBUG   2022-07-25 10:05:59.734146321 +00:00 < Access-Control-Allow-Methods: GET, POST, HEAD, OPTIONS
  DEBUG   2022-07-25 10:05:59.734165601 +00:00 < Access-Control-Allow-Headers: X-Sentry-Auth, X-Requested-With, Origin, Accept, Content-Type, Authentication, Authorization, Content-Encoding
  DEBUG   2022-07-25 10:05:59.734180128 +00:00 < Access-Control-Expose-Headers: X-Sentry-Error, Retry-After
  DEBUG   2022-07-25 10:05:59.734191689 +00:00 < Access-Control-Allow-Origin: *
  DEBUG   2022-07-25 10:05:59.734202745 +00:00 < Vary: Accept-Language, Cookie
  DEBUG   2022-07-25 10:05:59.734213922 +00:00 < Content-Language: en
  DEBUG   2022-07-25 10:05:59.734224828 +00:00 < X-Frame-Options: deny
  DEBUG   2022-07-25 10:05:59.734238319 +00:00 < X-Content-Type-Options: nosniff
  DEBUG   2022-07-25 10:05:59.734249714 +00:00 < X-XSS-Protection: 1; mode=block
  DEBUG   2022-07-25 10:05:59.734267354 +00:00 < X-Frame-Options: SAMEORIGIN
  DEBUG   2022-07-25 10:05:59.734278342 +00:00 < Strict-Transport-Security: max-age=15724800; includeSubDomains
  DEBUG   2022-07-25 10:05:59.734307834 +00:00 response status: 200
  DEBUG   2022-07-25 10:05:59.734325486 +00:00 body: {"url":"organizations/sentry/chunk-upload/","chunkSize":8388608,"chunksPerRequest":64,"maxFileSize":2147483648,"maxRequestSize":33554432,"concurrency":8,"hashAlgorithm":"sha1","compression":["gzip"],"accept":["debug_files","release_files","pdbs","sources","bcsymbolmaps"]}
> Bundling files for upload... ~/index.android.bundle.map
> Bundling completed in 0.759s
> Optimizing completed in 0.015s
  INFO    2022-07-25 10:06:00.509943620 +00:00 using 'gzip' compression for chunk upload
  DEBUG   2022-07-25 10:06:00.675976736 +00:00 request POST https://sentry.internal-passculture.app/api/0/organizations/sentry/chunk-upload/
  DEBUG   2022-07-25 10:06:00.676119306 +00:00 using token authentication
  DEBUG   2022-07-25 10:06:00.676163222 +00:00 sending form data
  DEBUG   2022-07-25 10:06:00.676198382 +00:00 retry number 0, max retries: 5
  DEBUG   2022-07-25 10:06:00.679250465 +00:00 > POST /api/0/organizations/sentry/chunk-upload/ HTTP/1.1
  DEBUG   2022-07-25 10:06:00.679324038 +00:00 > Host: sentry.internal-passculture.app
  DEBUG   2022-07-25 10:06:00.679350825 +00:00 > Accept: */*
  DEBUG   2022-07-25 10:06:00.679376821 +00:00 > Connection: TE
  DEBUG   2022-07-25 10:06:00.679404513 +00:00 > TE: gzip
  DEBUG   2022-07-25 10:06:00.679429257 +00:00 > User-Agent: sentry-cli/1.74.4
  DEBUG   2022-07-25 10:06:00.679775927 +00:00 > Authorization: Bearer XXXXX***
  DEBUG   2022-07-25 10:06:00.679805735 +00:00 > Content-Length: 4010334
  DEBUG   2022-07-25 10:06:00.679831338 +00:00 > Content-Type: multipart/form-data; boundary=------------------------784a4695fc8b644c
  DEBUG   2022-07-25 10:06:01.780588904 +00:00 < HTTP/1.1 200 OK
  DEBUG   2022-07-25 10:06:01.780668745 +00:00 < Date: Mon, 25 Jul 2022 10:06:01 GMT
  DEBUG   2022-07-25 10:06:01.780696217 +00:00 < Content-Length: 0
  DEBUG   2022-07-25 10:06:01.780720383 +00:00 < Connection: keep-alive
  DEBUG   2022-07-25 10:06:01.780742710 +00:00 < Allow: GET, POST, HEAD, OPTIONS
  DEBUG   2022-07-25 10:06:01.780765007 +00:00 < Access-Control-Allow-Methods: GET, POST, HEAD, OPTIONS
  DEBUG   2022-07-25 10:06:01.780796506 +00:00 < Access-Control-Allow-Headers: X-Sentry-Auth, X-Requested-With, Origin, Accept, Content-Type, Authentication, Authorization, Content-Encoding
  DEBUG   2022-07-25 10:06:01.780823517 +00:00 < Access-Control-Expose-Headers: X-Sentry-Error, Retry-After
  DEBUG   2022-07-25 10:06:01.780848093 +00:00 < Access-Control-Allow-Origin: *
  DEBUG   2022-07-25 10:06:01.780872133 +00:00 < Vary: Accept-Language, Cookie
  DEBUG   2022-07-25 10:06:01.780897001 +00:00 < Content-Language: en
  DEBUG   2022-07-25 10:06:01.780920142 +00:00 < X-Frame-Options: deny
  DEBUG   2022-07-25 10:06:01.780943351 +00:00 < X-Content-Type-Options: nosniff
  DEBUG   2022-07-25 10:06:01.780966142 +00:00 < X-XSS-Protection: 1; mode=block
  DEBUG   2022-07-25 10:06:01.780989886 +00:00 < X-Frame-Options: SAMEORIGIN
  DEBUG   2022-07-25 10:06:01.781012700 +00:00 < Strict-Transport-Security: max-age=15724800; includeSubDomains
  DEBUG   2022-07-25 10:06:01.781317721 +00:00 response status: 200
  DEBUG   2022-07-25 10:06:01.781347768 +00:00 body: 
> Uploading completed in 1.271s
> Uploaded release files to Sentry
  DEBUG   2022-07-25 10:06:01.781820011 +00:00 request POST https://sentry.internal-passculture.app/api/0/organizations/sentry/releases/1.197.93-android+codepush:v96/assemble/
  DEBUG   2022-07-25 10:06:01.781844730 +00:00 using token authentication
  DEBUG   2022-07-25 10:06:01.781865751 +00:00 json body: {"checksum":"213b4f3a7a430e00368c74e71ff3b6b9545c16d2","chunks":["213b4f3a7a430e00368c74e71ff3b6b9545c16d2"]}
  DEBUG   2022-07-25 10:06:01.781886242 +00:00 retry number 0, max retries: 5
  DEBUG   2022-07-25 10:06:01.782006883 +00:00 > POST /api/0/organizations/sentry/releases/1.197.93-android+codepush:v96/assemble/ HTTP/1.1
  DEBUG   2022-07-25 10:06:01.782022484 +00:00 > Host: sentry.internal-passculture.app
  DEBUG   2022-07-25 10:06:01.782034658 +00:00 > Accept: */*
  DEBUG   2022-07-25 10:06:01.782046177 +00:00 > Connection: TE
  DEBUG   2022-07-25 10:06:01.782058130 +00:00 > TE: gzip
  DEBUG   2022-07-25 10:06:01.782069484 +00:00 > User-Agent: sentry-cli/1.74.4
  DEBUG   2022-07-25 10:06:01.782092730 +00:00 > Authorization: Bearer XXXXX***
  DEBUG   2022-07-25 10:06:01.782103112 +00:00 > Content-Type: application/json
  DEBUG   2022-07-25 10:06:01.782112690 +00:00 > Content-Length: 109
  DEBUG   2022-07-25 10:06:01.921392877 +00:00 < HTTP/1.1 200 OK
  DEBUG   2022-07-25 10:06:01.921447213 +00:00 < Date: Mon, 25 Jul 2022 10:06:01 GMT
  DEBUG   2022-07-25 10:06:01.921461617 +00:00 < Content-Type: application/json
  DEBUG   2022-07-25 10:06:01.921479620 +00:00 < Content-Length: 38
  DEBUG   2022-07-25 10:06:01.921492785 +00:00 < Connection: keep-alive
  DEBUG   2022-07-25 10:06:01.921504948 +00:00 < Allow: POST, OPTIONS
  DEBUG   2022-07-25 10:06:01.921517136 +00:00 < Access-Control-Allow-Methods: POST, OPTIONS
  DEBUG   2022-07-25 10:06:01.921532284 +00:00 < Access-Control-Allow-Headers: X-Sentry-Auth, X-Requested-With, Origin, Accept, Content-Type, Authentication, Authorization, Content-Encoding
  DEBUG   2022-07-25 10:06:01.921544490 +00:00 < Access-Control-Expose-Headers: X-Sentry-Error, Retry-After
  DEBUG   2022-07-25 10:06:01.921557200 +00:00 < Access-Control-Allow-Origin: *
  DEBUG   2022-07-25 10:06:01.921569147 +00:00 < Vary: Accept-Language, Cookie
  DEBUG   2022-07-25 10:06:01.921581180 +00:00 < Content-Language: en
  DEBUG   2022-07-25 10:06:01.921604575 +00:00 < X-Frame-Options: deny
  DEBUG   2022-07-25 10:06:01.921617599 +00:00 < X-Content-Type-Options: nosniff
  DEBUG   2022-07-25 10:06:01.921629396 +00:00 < X-XSS-Protection: 1; mode=block
  DEBUG   2022-07-25 10:06:01.921641077 +00:00 < X-Frame-Options: SAMEORIGIN
  DEBUG   2022-07-25 10:06:01.921652938 +00:00 < Strict-Transport-Security: max-age=15724800; includeSubDomains
  DEBUG   2022-07-25 10:06:01.921680394 +00:00 response status: 200
  DEBUG   2022-07-25 10:06:01.921696069 +00:00 body: {"state":"created","missingChunks":[]}
> Processing completed in 0.14s
> File upload complete (processing pending on server)
> Organization: sentry
> Project: application-native
> Release: 1.197.93-android+codepush:v96
> Dist: 10197093-android

Source Map Upload Report
  Minified Scripts
    ~/index.android.bundle (sourcemap at index.android.bundle.map)
  Source Maps
    ~/index.android.bundle.map

It seems the upload succeed, but in the dashboard, I get no artifact for this release:

image

And no sourcemaps.

I also notice this comment on the documentation :

If you still have issues with CodePush source maps, you can refer to Source Maps for Other Platforms to manually bundle and upload source maps to Sentry.

This is missleading, as per your comment here, where you say we cannot use manual sourcemaps generation (what we used to use and that didn't work)

kopax-polyconseil commented 2 years ago

Meanwhile, I am trying to re-do the test for iOS code push, but I don't understand how to build from Linux the iOS sourcemaps.

It says I need to use two extra parameters when uploading the sourcemaps: --bundle-id {BUNDLE_ID} --version-name {VERSION_NAME}.

The first one I know what it is, while VERSION_NAME, I don't know what it is, neither members from my team (I asked on Slack), is it the app name in app.json? I presume it's not because it be automatlically detected?

marandaneto commented 2 years ago

Version name comes from appcenter and has the {}@{}+codepush:{} pattern. https://github.com/getsentry/sentry-cli/blob/e08e7c31d93a29797edf7d1e5ec42ee0453ecc49/src/utils/appcenter.rs#L191-L194 It should be the value within the 2nd {}. On iOS, this is defined here e.g. https://github.com/getsentry/sentry-react-native/blob/abc947fd04033997fd431c3ea09196718b60b872/sample/ios/sample/Info.plist#L19-L20 So its the same value as CFBundleShortVersionString

kopax-polyconseil commented 2 years ago

Version name comes from appcenter and has the {}@{}+codepush:{} pattern. https://github.com/getsentry/sentry-cli/blob/e08e7c31d93a29797edf7d1e5ec42ee0453ecc49/src/utils/appcenter.rs#L191-L194 It should be the value within the 2nd {}.

I presume it means it's version from our package.json, as we don't have the leading {}@

image

I will try to redo the test on the iOS version to see if it's better than what we got for code push and Android.

kopax-polyconseil commented 2 years ago

I finally got it (codepush + sourcemaps) working on Android, thanks to the massive help of the Sentry team :

image

This will really help our team, I am grateful for the time spent trying to help us, and your reactivity, the product will be much better now that this is configured.

I am testing with iOS now, but no doubt it will work very soon !

Edit 1

image

iOS :heavy_check_mark:

Edit 2 :warning: Regarding the closed PR here, I left a comment but I believe this must be corrected and cannot stay in such state.

Noitham commented 1 year ago

So what did you have to do to get it working? :)

@kopax-polyconseil

Akeuuh commented 1 year ago

Glad you find the solution, but can you share it ? I'm reading this thread (and others) for 15 min and I can't find a solution

developerdanx commented 1 year ago

Can you share the solution please? I have the same problem and my source-maps are uploaded correctly but the errors don't leave the trace where it's fired from a CodePush version.

kopax-polyconseil commented 1 year ago

Solution can be found on this repo : https://github.com/pass-culture/pass-culture-app-native

developerdanx commented 1 year ago

Hi @kopax-polyconseil first of all, thank you for sharing your solution.

Very dark waters with appcenter-cli. The guilty was indeed the cli from appcenter not creating correctly /index.android.bundle and /index.android.bundle.map files.

With "react-native": "0.70.4", I had to use the version "appcenter-cli": "2.11.0"