Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when uploading sourcemaps to Sentry (Error 413, request entity too large) #326

Closed
2 of 5 tasks
SanderVerkuil opened this issue Jan 10, 2018 · 25 comments
Closed
2 of 5 tasks

Comments

@SanderVerkuil
Copy link

SanderVerkuil commented Jan 10, 2018

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

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

5.6.0
[email protected] /home/sander/Projecten/react/LDBeheer
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── UNMET PEER DEPENDENCY [email protected]
├── [email protected]
├── UNMET PEER DEPENDENCY [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] invalid
├── [email protected]
├── [email protected] invalid
├── [email protected] invalid
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] invalid
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

npm ERR! peer dep missing: [email protected], required by [email protected]
npm ERR! peer dep missing: [email protected], required by [email protected]
npm ERR! peer dep missing: react-native@^0.50.4, required by [email protected]
npm ERR! invalid: [email protected] /home/sander/Projecten/react/LDBeheer/node_modules/react-native-image-to-base64
npm ERR! invalid: [email protected] /home/sander/Projecten/react/LDBeheer/node_modules/react-native-material-ui
npm ERR! extraneous: [email protected] /home/sander/Projecten/react/LDBeheer/node_modules/color
npm ERR! extraneous: [email protected] /home/sander/Projecten/react/LDBeheer/node_modules/lodash.merge
npm ERR! extraneous: [email protected] /home/sander/Projecten/react/LDBeheer/node_modules/react-native-material-design-styles
npm ERR! invalid: [email protected] /home/sander/Projecten/react/LDBeheer/node_modules/react-native-md-textinput
npm ERR! invalid: [email protected] /home/sander/Projecten/react/LDBeheer/node_modules/react-native-temperature-sensors

Config:

Sentry.config('https://[email protected]/...').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?

@HazAT
Copy link
Member

HazAT commented Jan 31, 2018

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.
getsentry/sentry#7095

Please be patient and bare with us 🍪

@HazAT HazAT self-assigned this Jan 31, 2018
@dmitrika
Copy link

dmitrika commented Feb 6, 2018

@HazAT Did I get it right, now we have to uninstall rn-sentry to be able to build an android app?

@SanderVerkuil
Copy link
Author

SanderVerkuil commented Feb 6, 2018

@dmitrika as far as I could tell removing the upload gradle task from the android/app/build.gradle should do the trick. You just don't have the codemaps on sentry.

@lig
Copy link

lig commented Mar 2, 2018

@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!

@se-bastiaan
Copy link

se-bastiaan commented Aug 11, 2018

So I tried to understand the work done on chunk uploading. Maybe even fix this. These are my notes in that process.

sentry-cli has code for uploading chunks and assembling them:
upload chunks
assemble chunks

However, the SourceMapProcessor used in the react-native x (x in [gradle, xcode, appcenter, codepush]) doesn't use the chunk upload (yet?). It's only used in the upload_dif command.

I don't think I completely grasp everything, but what I suspect that the current chunk upload was especially made for dsyms (and related difs) and not for the JS sourcemaps since those use the release file upload.

@HazAT
Copy link
Member

HazAT commented Aug 13, 2018

@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.

@lizraeli
Copy link

@SanderVerkuil sorry for the noob question: what exactly do you mean by

removing the upload gradle task from the build.properties

There is no build.properties file as far as I can tell. The build.gradle file applies a script from react-native-sentry:

apply from: "../../node_modules/react-native-sentry/sentry.gradle"

And to my understanding it is that script that is in charge of uploading the source map. Did you mean we should remove the apply from... line in build.gradle?

@se-bastiaan
Copy link

se-bastiaan commented Aug 13, 2018

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.

@SanderVerkuil
Copy link
Author

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. 😃

@badaz
Copy link

badaz commented Nov 5, 2018

Still no news about this issue ? In what way is the upload process different from the old way doing it all manually (when it was only raven-js) ? Is there any java code being sent too ?

@malcommac
Copy link

Still no news about that?

@badaz
Copy link

badaz commented Nov 14, 2018

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

@HazAT
Copy link
Member

HazAT commented Nov 15, 2018

ref: #488

@icewind7030
Copy link

Any updates? My sourcemap file was just 1.1M and this error happened too.

@lambdaq
Copy link

lambdaq commented Mar 21, 2019

@badaz

I changed client_max_body_size 20m and it worked.

@HazAT
Copy link
Member

HazAT commented Jul 5, 2019

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

@HazAT HazAT closed this as completed Jul 5, 2019
@zmnv
Copy link

zmnv commented Oct 20, 2019

@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

@bigman212
Copy link

bigman212 commented Feb 7, 2020

@HazAT

@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

same here,
we are running self hosted sentry server, and we've overridden sentry.conf.py by adding 'limit-post' property in SENTRY_WEB_OPTIONS; It looks like this:

SENTRY_WEB_OPTIONS = {
    'limit-post': 20000000
}

Also there is full debug log below.
sentry_request.txt

@davidpaley
Copy link

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

@kozak-codes
Copy link

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

@davidpaley
Copy link

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
    },
  })
}

@brascene
Copy link

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.

@zhekix
Copy link

zhekix commented May 23, 2023

why suddenly I started to receive this 413 error since I'm using Sentry for long time and never experienced it before.

+1, the same

@krystofwoldrich
Copy link
Member

@zhekix @brascene If this is something new happening with the recent version of the sentry-react-native package, please consider opening a new issue with your app context.

@brascene
Copy link

@krystofwoldrich I didn't upgrade to a new version, currently I'm on v4.8.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests