sentry-react-native: Error when uploading sourcemaps to Sentry (Error 413, request entity too large)

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

Output of node -v && npm -v && npm ls --prod --depth=0

5.6.0
LDBeheer@1.0.0 /home/sander/Projecten/react/LDBeheer
├── babel-plugin-transform-decorators-legacy@1.3.4
├── babel-plugin-transform-remove-console@6.8.5
├── buffer@5.0.8
├── fuse.js@3.2.0
├── jslinter@1.5.37
├── moment@2.20.1
├── prop-types@15.6.0
├── UNMET PEER DEPENDENCY react@16.2.0
├── react-mixin@4.0.0
├── UNMET PEER DEPENDENCY react-native@0.52.0
├── react-native-cached-image@1.4.3
├── react-native-circular-progress@0.1.2
├── react-native-config@0.11.4
├── react-native-fabric@0.5.1
├── react-native-fetch-blob@0.10.8
├── react-native-image-picker@0.26.7
├── react-native-image-to-base64@0.1.0 invalid
├── react-native-keep-awake@2.0.6
├── react-native-material-ui@1.19.0 invalid
├── react-native-md-textinput@2.1.0 invalid
├── react-native-onesignal@3.0.7
├── react-native-pathjs-charts@0.0.33
├── react-native-select-multiple@1.2.0
├── react-native-sentry@0.32.1
├── react-native-snackbar-component@1.0.8
├── react-native-svg@5.5.1
├── react-native-temperature-sensors@1.3.1 invalid
├── react-native-uuid@1.4.9
├── react-native-vector-icons@4.4.3
├── react-native-video@2.0.0
├── react-navigation@1.0.0-beta.23
├── react-redux@5.0.6
├── react-timer-mixin@0.13.3
├── redux@3.7.2
├── redux-persist@5.4.0
├── redux-persist-filesystem-storage@1.1.1
├── redux-persist-fs-storage@1.2.0
├── redux-saga@0.15.6
├── reselect@3.0.1
├── safe-buffer@5.1.1
└── underscore@1.8.3

npm ERR! peer dep missing: react@16.0.0, required by react-native-material-ui@1.19.0
npm ERR! peer dep missing: react-native@0.50.4, required by react-native-material-ui@1.19.0
npm ERR! peer dep missing: react-native@^0.50.4, required by react-native-temperature-sensors@1.3.1
npm ERR! invalid: react-native-image-to-base64@0.1.0 /home/sander/Projecten/react/LDBeheer/node_modules/react-native-image-to-base64
npm ERR! invalid: react-native-material-ui@1.19.0 /home/sander/Projecten/react/LDBeheer/node_modules/react-native-material-ui
npm ERR! extraneous: color@2.0.1 /home/sander/Projecten/react/LDBeheer/node_modules/color
npm ERR! extraneous: lodash.merge@4.6.0 /home/sander/Projecten/react/LDBeheer/node_modules/lodash.merge
npm ERR! extraneous: react-native-material-design-styles@0.2.7 /home/sander/Projecten/react/LDBeheer/node_modules/react-native-material-design-styles
npm ERR! invalid: react-native-md-textinput@2.1.0 /home/sander/Projecten/react/LDBeheer/node_modules/react-native-md-textinput
npm ERR! invalid: react-native-temperature-sensors@1.3.1 /home/sander/Projecten/react/LDBeheer/node_modules/react-native-temperature-sensors

Config:

Sentry.config('https://...@sentry.io/...').install()

I have following issue:

The build fails for production when uploading the sourcemaps:

bundle: Writing bundle output to: /home/sander/Projecten/react/LDBeheer/android/app/build/intermediates/assets/release/index.android.bundle
bundle: Writing sourcemap output to: /home/sander/Projecten/react/LDBeheer/android/app/build/intermediates/assets/release/index.android.bundle.map
bundle: Done writing bundle output
bundle: Done writing sourcemap output
bundle: Copying 82 asset files
bundle: Done copying assets
Processing react-native sourcemaps for Sentry upload.
> Analyzing 2 sources
> Rewriting sources
> Adding source map references
Uploading sourcemaps for release com.LDBeheer-1.0.0 distribution 198
> Uploading source maps for release com.LDBeheer-1.0.0
error: http error: generic error (413)
:app:bundleReleaseJsAndAssets FAILED

FAILURE: Build failed with an exception.

* Where:
Script '/home/sander/Projecten/react/LDBeheer/node_modules/react-native-sentry/sentry.gradle' line: 154

* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssetsreleaseSentryUpload'.
> Process 'command 'node_modules/@sentry/cli/bin/sentry-cli'' finished with non-zero exit value 1

Output of ls -lah android/app/build/intermediates/assets/release:

totaal 49M
drwxr-xr-x 3 sander sander 4,0K 10 jan 16:05 .
drwxr-xr-x 4 sander sander 4,0K  5 dec 20:46 ..
-rw-r--r-- 1 sander sander  336 10 jan 16:28 crashlytics-build.properties
drwxr-xr-x 2 sander sander 4,0K 10 jan 16:03 fonts
-rw-r--r-- 1 sander sander 1,6M 10 jan 16:30 index.android.bundle
-rw-r--r-- 1 sander sander  47M 10 jan 16:30 index.android.bundle.map
-rw-r--r-- 1 sander sander   21 10 jan 16:30 index.android.bundle.meta

Steps to reproduce:

  • Step 1: Run ./gradlew assembleRelease

Actual result:

  • Actual: It crashes when uploading the sourcemaps

Expected result:

  • Expected the sourcemaps to be uploaded.

What is the maximal filesize of the sourcemaps?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 9
  • Comments: 25 (5 by maintainers)

Most upvoted comments

@badaz

I changed client_max_body_size 20m and it worked.

I found a solution but it is only possible if you host your own sentry server. I had to allow a bigger max request body size in my nginx proxy settings

@se-bastiaan You are right! We still want to support chunk upload for source maps though. I can’t give you an exact timeframe when this will happen but I have something other in mind. We will soon ship (1-2 weeks) gzip compression for uploads with Sentry CLI, this should at least buy us some time until we hit the cap again. Will comment here again when everything is in production.

The newest version of sentry-cli should fix this issue.

Yes, the workaround of removing apply from: "../../node_modules/react-native-sentry/sentry.gradle" works fine. I think build.properties in that comment should’ve been build.gradle.

@HazAT Hello! I see several PRs merged in context of this one. Is there any roadmap for everything related? It will be handy to be able to keep track of this. Thank you!

Thanks @davidpaley

I solved this problem with the beforeBreadcrumb attribute

Sentry.init({
    dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
    enabled: true,
    integrations: [
      new RewriteFrames({
        iteratee: frame => {
          frame.filename = frame.filename.replace(distDir, 'app:///_next')
          return frame
        },
      }),
    ],
    release: COMMIT_ID,
    environment: DEPLOYMENT_TYPE,
    beforeBreadcrumb(breadcrumb) {
      if (breadcrumb.category === 'console') {
        return null
      }
      return breadcrumb
    },
  })
}

this resolved the issue for me as well, although I don’t understand the reason behind this and why suddenly I started to receive this 413 error since I’m using Sentry for long time and never experienced it before.

I was hosting on prem on kubernetes with nginx ignress and had to set the following ingress annotations:

    nginx.ingress.kubernetes.io/client_max_body_size: 30m
    nginx.ingress.kubernetes.io/proxy-body-size: 30m

still having this issue using @sentry/react (version 5.20.1)

@HazAT Hm…

request GET https://sentry.***.ninja/api/0/organizations/***/chunk-upload/

result
body: {"maxFileSize": 2147483648, "hashAlgorithm": "sha1", "concurrency": 4, "chunkSize": 8388608, "maxRequestSize": 33554432, "url": "https://sentry.***.ninja/api/0/organizations/***/chunk-upload/", "chunksPerRequest": 64, "compression": ["gzip"]}

...

request POST https://sentry.enapter.ninja/api/0/projects/enapter/react-native/files/difs/assemble/

request body: {"*****":{"name":"***","chunks":["dd7589643d767735ac7fd332b4d8b1f442056f96","8d64dc5c61acc32a4218975ce9e85670c9826a12","5faecb8cb41c0df1d11f3669ccac042e0186c991","481b8fbbb1f49dd844336b7eda611366bfef866b","87d967ef7dcd9d7e79a8a4ca63400aff0e43bf7a","c169a756a75fe9457c5dd1c85025b331419498a6"]}}

response
body: {"***": {"state": "not_found", "missingChunks": ["87d967ef7dcd9d7e79a8a4ca63400aff0e43bf7a", "dd7589643d767735ac7fd332b4d8b1f442056f96", "5faecb8cb41c0df1d11f3669ccac042e0186c991", "481b8fbbb1f49dd844336b7eda611366bfef866b", "8d64dc5c61acc32a4218975ce9e85670c9826a12", "c169a756a75fe9457c5dd1c85025b331419498a6"]}}

error: API request failed
  caused by: sentry reported an error: unknown error (http status: 413)

    iOS 12.2
    "@sentry/react-native": "1.0.9",
    "react": "16.8.6",
    "react-native": "0.60.4",

sentry-cli 1.48.0

Did you mean we should remove the apply from… line in build.gradle

Yes, I made a mistake, it should’ve been android/app/build.gradle. I modified my original comment, fixing the mistake. 😃

Hey, sorry for the late reply. Currently, there is a limit in Sentry when uploading large artifacts. We are working to fix this since it is not 100% deterministic when a request is too large. https://github.com/getsentry/sentry/pull/7095

Please be patient and bare with us 🍪