getsentry / sentry-cli

A command line utility to work with Sentry.
https://docs.sentry.io/cli/
BSD 3-Clause "New" or "Revised" License
893 stars 221 forks source link

Sentry received the bundled react native js file for a release as empty #1633

Closed GibbyBox closed 1 year ago

GibbyBox commented 1 year ago

Environment

CLI Version 1.74.4 OS: ubuntu 22.04.2 LTS (github action worker) and macOS Monterey 12.4

Steps to Reproduce

So I have two attempts at this. One is using the sentry github action. The other is using the sentry cli directly. Both produce the same issue. With using the cli directly, I'm printing out file size and I see the file size is non-zero. I also tried this script on my local machine and I see it uploads the bundle as an empty file. The map file is not empty.

I am using this for sending source maps for an over the air release of an expo app following the instructions on expo's doc site

directly

          cp ${{ env.ios_jsSourceFile }} ${{ env.ios_targetFile }}
          stat ${{ env.ios_targetFile }}
          npx sentry-cli \
            --log-level=debug \
            --auth-token ${{ secrets.SENTRY_AUTH_TOKEN }} \
            releases \
            --org ${{ secrets.SENTRY_ORG }} \
            --project ${{ secrets.SENTRY_PROJECT }} \
            files ${{ env.ios_id }} \
            upload-sourcemaps \
            --dist ${{ env.ios_dist }} \
            --rewrite ${{ env.ios_targetFile }} ${{ env.ios_mapFile }}

via the action

      - name: Sentry Upload IOS release
        uses: getsentry/action-release@v1.4.1
        env:
          SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
          SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
          SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
        with:
          environment: production
          sourcemaps: ${{ env.ios_targetFile }} ${{ env.ios_mapFile }}
          dist: ${{ env.ios_dist }}
          version: ${{ env.ios_id }}
          set_commits: skip

image

Expected/Actual Result

The main.jsbundle file in the Sentry dashboard should not be 0B in size.

Logs

Run cp dist/bundles/ios-d2f662b29b372efaf0b5c5c0b4e120dd.js dist/bundles/main.jsbundle
  File: dist/bundles/main.jsbundle
  Size: 4696678     Blocks: 9176       IO Block: 4096   regular file
Device: 811h/2065d  Inode: 869097      Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1001/  runner)   Gid: (  123/  docker)
Access: 2023-05-30 14:59:40.776746041 +0000
Modify: 2023-05-30 14:59:40.780746055 +0000
Change: 2023-05-30 14:59:40.780746055 +0000
 Birth: 2023-05-30 14:59:40.776746041 +0000
  DEBUG   2023-05-30 14:59:41.220276658 +00:00 sentry-cli version: 1.74.4, platform: "linux", architecture: "x86_64"
  INFO    2023-05-30 14:59:41.220335459 +00:00 sentry-cli was invoked with the following command line: "/home/runner/work/***-mobile/***-mobile/node_modules/@sentry/cli/sentry-cli" "--log-level=debug" "--auth-token" "***" "releases" "--org" "***" "--project" "***" "files" "com.app.staging.***@1.9.0+1" "upload-sourcemaps" "--dist" "a2b4b4e1-c86d-49cd-9011-445c81381c26" "--rewrite" "dist/bundles/main.jsbundle" "dist/bundles/ios-d2f662b29b372efaf0b5c5c0b4e120dd.map"
> Found 1 release file
> Found 1 release file
> Analyzing 2 sources
> Rewriting sources
> Adding source map references
  DEBUG   2023-05-30 14:59:42.187457652 +00:00 request POST https://sentry.io/api/0/projects/***/***-mobile-dev/releases/
  DEBUG   2023-05-30 14:59:42.187484352 +00:00 using token authentication
  DEBUG   2023-05-30 14:59:42.187495552 +00:00 json body: {"version":"com.app.staging.***@1.9.0+1","projects":["***-mobile-dev"]}
  DEBUG   2023-05-30 14:59:42.187502652 +00:00 retry number 0, max retries: 0
  DEBUG   2023-05-30 14:59:42.293597010 +00:00 > POST /api/0/projects/***/***-mobile-dev/releases/ HTTP/1.1
  DEBUG   2023-05-30 14:59:42.293627910 +00:00 > Host: sentry.io
  DEBUG   2023-05-30 14:59:42.293634310 +00:00 > Accept: */*
  DEBUG   2023-05-30 14:59:42.293640110 +00:00 > Connection: TE
  DEBUG   2023-05-30 14:59:42.293645710 +00:00 > TE: gzip
  DEBUG   2023-05-30 14:59:42.293651210 +00:00 > User-Agent: sentry-cli/1.74.4
  DEBUG   2023-05-30 14:59:42.293990911 +00:00 > Authorization: ***
  DEBUG   2023-05-30 14:59:42.293998011 +00:00 > Content-Type: application/json
  DEBUG   2023-05-30 14:59:42.294476413 +00:00 > Content-Length: 78
  DEBUG   2023-05-30 14:59:42.531402811 +00:00 < HTTP/1.1 208 Already Reported
  DEBUG   2023-05-30 14:59:42.531437311 +00:00 < Server: nginx
  DEBUG   2023-05-30 14:59:42.531447211 +00:00 < Date: Tue, 30 May 2023 14:59:42 GMT
  DEBUG   2023-05-30 14:59:42.531454611 +00:00 < Content-Type: application/json
  DEBUG   2023-05-30 14:59:42.531461611 +00:00 < Content-Length: 811
  DEBUG   2023-05-30 14:59:42.531468511 +00:00 < Connection: keep-alive
  DEBUG   2023-05-30 14:59:42.531474711 +00:00 < allow: GET, POST, HEAD, OPTIONS
  DEBUG   2023-05-30 14:59:42.531481311 +00:00 < access-control-allow-methods: GET, POST, HEAD, OPTIONS
  DEBUG   2023-05-30 14:59:42.531494611 +00:00 < access-control-allow-headers: X-Sentry-Auth, X-Requested-With, Origin, Accept, Content-Type, Authentication, Authorization, Content-Encoding, sentry-trace, baggage, X-CSRFToken
  DEBUG   2023-05-30 14:59:42.531501811 +00:00 < access-control-expose-headers: X-Sentry-Error, Retry-After
  DEBUG   2023-05-30 14:59:42.531508111 +00:00 < access-control-allow-origin: *
  DEBUG   2023-05-30 14:59:42.531522811 +00:00 < x-sentry-rate-limit-remaining: 199
  DEBUG   2023-05-30 14:59:42.531529111 +00:00 < x-sentry-rate-limit-limit: 200
  DEBUG   2023-05-30 14:59:42.531535512 +00:00 < x-sentry-rate-limit-reset: 1685458783
  DEBUG   2023-05-30 14:59:42.531542112 +00:00 < x-sentry-rate-limit-concurrentremaining: 199
  DEBUG   2023-05-30 14:59:42.531548312 +00:00 < x-sentry-rate-limit-concurrentlimit: 200
  DEBUG   2023-05-30 14:59:42.531554712 +00:00 < vary: Accept-Language, Cookie
  DEBUG   2023-05-30 14:59:42.531561712 +00:00 < content-language: en
  DEBUG   2023-05-30 14:59:42.531568012 +00:00 < x-frame-options: deny
  DEBUG   2023-05-30 14:59:42.531574112 +00:00 < x-content-type-options: nosniff
  DEBUG   2023-05-30 14:59:42.531580312 +00:00 < x-xss-protection: 1; mode=block
  DEBUG   2023-05-30 14:59:42.531587212 +00:00 < content-security-policy: default-src *; img-src * blob: data:; base-uri 'none'; font-src * data:; object-src 'self'; style-src * 'unsafe-inline'; connect-src *; frame-ancestors 'self'; script-src 'self' 'unsafe-inline' 'report-sample' 'unsafe-eval' s1.sentry-cdn.com js.sentry-cdn.com browser.sentry-cdn.com statuspage-production.s3.amazonaws.com static.zdassets.com aui-cdn.atlassian.com connect-cdn.atl-paas.net js.stripe.com ssl.google-analytics.com 'strict-dynamic' cdn.pendo.io data.pendo.io pendo-io-static.storage.googleapis.com pendo-static-5634074999128064.storage.googleapis.com; report-uri https://o1.ingest.sentry.io/api/54785/security/?sentry_key=f724a8a027db45f5b21507e7142ff78e&sentry_release=524dcbe31e7f3d9c4fc5467fcde95514f63f0f36
  DEBUG   2023-05-30 14:59:42.531594912 +00:00 < x-envoy-attempt-count: 1
  DEBUG   2023-05-30 14:59:42.531600912 +00:00 < x-envoy-upstream-service-time: 205
  DEBUG   2023-05-30 14:59:42.531607112 +00:00 < x-served-by: getsentry-web-default-common-production-bf975c446-5fr7q
  DEBUG   2023-05-30 14:59:42.531613212 +00:00 < x-served-by: lb-0
  DEBUG   2023-05-30 14:59:42.531619512 +00:00 < Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
  DEBUG   2023-05-30 14:59:42.531647612 +00:00 response status: 208
  DEBUG   2023-05-30 14:59:42.531657912 +00:00 body: {"id":751112503,"version":"com.app.staging.***@1.9.0+1","status":"open","shortVersion":"com.app.staging.***@1.9.0+1","versionInfo":{"package":"com.app.staging.***","version":{"raw":"1.9.0+1","major":1,"minor":9,"patch":0,"pre":null,"buildCode":"1","components":3},"description":"1.9.0 (1)","buildHash":null},"ref":null,"url":null,"dateReleased":null,"dateCreated":"2023-05-30T14:34:31.951985Z","data":{},"newGroups":0,"owner":null,"commitCount":0,"lastCommit":null,"deployCount":0,"lastDeploy":null,"authors":[],"projects":[{"id":4505081138839552,"slug":"***-mobile-dev","name":"***-mobile-dev","newGroups":0,"platform":"react-native","platforms":["cocoa","javascript","node"],"hasHealthData":false}],"firstEvent":null,"lastEvent":null,"currentProjectMeta":{},"userAgent":"sentry-cli/1.74.4"}
  DEBUG   2023-05-30 14:59:42.537464531 +00:00 request GET https://sentry.io/api/0/organizations/***/chunk-upload/
  DEBUG   2023-05-30 14:59:42.537496232 +00:00 using token authentication
  DEBUG   2023-05-30 14:59:42.537506132 +00:00 retry number 0, max retries: 0
  DEBUG   2023-05-30 14:59:42.538001433 +00:00 > GET /api/0/organizations/***/chunk-upload/ HTTP/1.1
  DEBUG   2023-05-30 14:59:42.538014733 +00:00 > Host: sentry.io
  DEBUG   2023-05-30 14:59:42.538020833 +00:00 > Accept: */*
  DEBUG   2023-05-30 14:59:42.538026533 +00:00 > Connection: TE
  DEBUG   2023-05-30 14:59:42.538031933 +00:00 > TE: gzip
  DEBUG   2023-05-30 14:59:42.538037533 +00:00 > User-Agent: sentry-cli/1.74.4
  DEBUG   2023-05-30 14:59:42.538135234 +00:00 > Authorization: ***
  DEBUG   2023-05-30 14:59:42.614132090 +00:00 < HTTP/1.1 200 OK
  DEBUG   2023-05-30 14:59:42.614165390 +00:00 < Server: nginx
  DEBUG   2023-05-30 14:59:42.614175390 +00:00 < Date: Tue, 30 May 2023 14:59:42 GMT
  DEBUG   2023-05-30 14:59:42.614183190 +00:00 < Content-Type: application/json
  DEBUG   2023-05-30 14:59:42.614190690 +00:00 < Content-Length: 317
  DEBUG   2023-05-30 14:59:42.614197990 +00:00 < Connection: keep-alive
  DEBUG   2023-05-30 14:59:42.614204190 +00:00 < allow: GET, POST, HEAD, OPTIONS
  DEBUG   2023-05-30 14:59:42.614211090 +00:00 < access-control-allow-methods: GET, POST, HEAD, OPTIONS
  DEBUG   2023-05-30 14:59:42.614220690 +00:00 < access-control-allow-headers: X-Sentry-Auth, X-Requested-With, Origin, Accept, Content-Type, Authentication, Authorization, Content-Encoding, sentry-trace, baggage, X-CSRFToken
  DEBUG   2023-05-30 14:59:42.614227490 +00:00 < access-control-expose-headers: X-Sentry-Error, Retry-After
  DEBUG   2023-05-30 14:59:42.614233790 +00:00 < access-control-allow-origin: *
  DEBUG   2023-05-30 14:59:42.614239790 +00:00 < x-sentry-rate-limit-remaining: 199
  DEBUG   2023-05-30 14:59:42.614246190 +00:00 < x-sentry-rate-limit-limit: 200
  DEBUG   2023-05-30 14:59:42.614252890 +00:00 < x-sentry-rate-limit-reset: 1685458783
  DEBUG   2023-05-30 14:59:42.614259090 +00:00 < x-sentry-rate-limit-concurrentremaining: 199
  DEBUG   2023-05-30 14:59:42.614265090 +00:00 < x-sentry-rate-limit-concurrentlimit: 200
  DEBUG   2023-05-30 14:59:42.614271290 +00:00 < vary: Accept-Language, Cookie
  DEBUG   2023-05-30 14:59:42.614278590 +00:00 < content-language: en
  DEBUG   2023-05-30 14:59:42.614284890 +00:00 < x-frame-options: deny
  DEBUG   2023-05-30 14:59:42.614290890 +00:00 < x-content-type-options: nosniff
  DEBUG   2023-05-30 14:59:42.614296990 +00:00 < x-xss-protection: 1; mode=block
  DEBUG   2023-05-30 14:59:42.614304990 +00:00 < content-security-policy: frame-ancestors 'self'; img-src * blob: data:; base-uri 'none'; script-src 'self' 'unsafe-inline' 'report-sample' 'unsafe-eval' s1.sentry-cdn.com js.sentry-cdn.com browser.sentry-cdn.com statuspage-production.s3.amazonaws.com static.zdassets.com aui-cdn.atlassian.com connect-cdn.atl-paas.net js.stripe.com ssl.google-analytics.com 'strict-dynamic' cdn.pendo.io data.pendo.io pendo-io-static.storage.googleapis.com pendo-static-5634074999128064.storage.googleapis.com; object-src 'self'; default-src *; style-src * 'unsafe-inline'; connect-src *; font-src * data:; report-uri https://o1.ingest.sentry.io/api/54785/security/?sentry_key=f724a8a027db45f5b21507e7142ff78e&sentry_release=524dcbe31e7f3d9c4fc5467fcde95514f63f0f36
  DEBUG   2023-05-30 14:59:42.614312290 +00:00 < x-envoy-attempt-count: 1
  DEBUG   2023-05-30 14:59:42.614318590 +00:00 < x-envoy-upstream-service-time: 45
  DEBUG   2023-05-30 14:59:42.614324890 +00:00 < x-served-by: getsentry-web-default-common-production-bf975c446-cf9ws
  DEBUG   2023-05-30 14:59:42.614330990 +00:00 < x-served-by: lb-0
  DEBUG   2023-05-30 14:59:42.614337290 +00:00 < Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
  DEBUG   2023-05-30 14:59:42.614359591 +00:00 response status: 200
  DEBUG   2023-05-30 14:59:42.614367691 +00:00 body: {"url":"organizations/***/chunk-upload/","chunkSize":8388608,"chunksPerRequest":64,"maxFileSize":2147483648,"maxRequestSize":33554432,"concurrency":8,"hashAlgorithm":"sha1","compression":["gzip"],"accept":["debug_files","release_files","pdbs","sources","bcsymbolmaps","il2cpp","portablepdbs","artifact_bundles"]}
> Bundled 2 files for upload
> Uploaded release files to Sentry
> File upload complete (processing pending on server)
> Organization: ***
> Project: ***-mobile-dev
> Release: com.app.staging.***@1.9.0+1
> Dist: a2b4b4e1-c86d-49cd-9011-445c81381c26

Source Map Upload Report
  Minified Scripts
  DEBUG   2023-05-30 14:59:43.974283173 +00:00 skipping update nagger because session is not attended
    ~/main.jsbundle (sourcemap at ios-d2f662b29b372efaf0b5c5c0b4e120dd.map)
  Source Maps
    ~/ios-d2f662b29b372efaf0b5c5c0b4e120dd.map
kamilogorek commented 1 year ago

This is actually a desired behavior explained here https://github.com/getsentry/sentry-cli/blob/033bd2173e3aeb82941913efdee4b80add99ea0c/src/utils/sourcemaps.rs#L272-L278

github-actions[bot] commented 1 year ago

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀