getsentry / sentry-android-gradle-plugin

Gradle plugin for Sentry Android. Upload proguard, debug files, and more.

Home Page:https://docs.sentry.io/platforms/android/gradle/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to upload proguard file to Sentry (Error 413 File Too Large)

ravishaccedo opened this issue · comments

Gradle Version

8.3

AGP Version

8.1.1

Code Minifier/Optimizer

R8

Version

4.5.1

Sentry SDK Version

7.9.0

Steps to Reproduce

When building a release version of the app, the build fails at task :uploadSentryProguardMappings.
When running the build again with debug option we are seeing that the sentry-cli fails with error 413 "File too large"

We tried uploading the same mapping file separately as well using the standalone sentry-cli and we are getting the same error.

The size of the uncompressed mapping file is 188 MB and when compressed it comes down to 11 MB (approx)

Below is the output of the sentry-cli

`sentry-cli upload-proguard app/build/outputs/mapping/devRelease/mapping.txt --project sbt-android --log-level debug
DEBUG 2024-05-13 18:03:49.404793 +02:00 sentry-cli version: 2.31.2, platform: "darwin", architecture: "arm64"
INFO 2024-05-13 18:03:49.405465 +02:00 sentry-cli was invoked with the following command line: "sentry-cli" "upload-proguard" "app/build/outputs/mapping/devRelease/mapping.txt" "--project" "sbt-android" "--log-level" "debug"
DEBUG 2024-05-13 18:03:49.966442 +02:00 SHA1 for mapping file 'app/build/outputs/mapping/devRelease/mapping.txt': '05c630b6261522d56b72709e264da69d3cec2589'

compressing mappings
uploading mappings
INFO 2024-05-13 18:03:52.231704 +02:00 Issuing a command for Organization: maissbt Project: sbt-android
DEBUG 2024-05-13 18:03:52.233971 +02:00 request POST https://sentry.maissbt.com/api/0/projects/maissbt/sbt-android/files/dsyms/
DEBUG 2024-05-13 18:03:52.233980 +02:00 using token authentication
DEBUG 2024-05-13 18:03:52.233985 +02:00 sending form data
DEBUG 2024-05-13 18:03:52.233987 +02:00 retry number 0, max retries: 0
DEBUG 2024-05-13 18:03:52.673557 +02:00 > POST /api/0/projects/maissbt/sbt-android/files/dsyms/ HTTP/1.1
DEBUG 2024-05-13 18:03:52.673619 +02:00 > Host: sentry.maissbt.com
DEBUG 2024-05-13 18:03:52.673629 +02:00 > Accept: /
DEBUG 2024-05-13 18:03:52.673636 +02:00 > Connection: TE
DEBUG 2024-05-13 18:03:52.673642 +02:00 > TE: gzip
DEBUG 2024-05-13 18:03:52.673649 +02:00 > User-Agent: sentry-cli/2.31.2
DEBUG 2024-05-13 18:03:52.674747 +02:00 > Authorization: Bearer sntrys_e***
DEBUG 2024-05-13 18:03:52.674763 +02:00 > Content-Length: 11662201
DEBUG 2024-05-13 18:03:52.674769 +02:00 > Content-Type: multipart/form-data; boundary=------------------------b7b3df342e03fbda
DEBUG 2024-05-13 18:03:52.779045 +02:00 < HTTP/1.1 413 Request Entity Too Large
DEBUG 2024-05-13 18:03:52.779424 +02:00 < Server: nginx/1.18.0 (Ubuntu)
DEBUG 2024-05-13 18:03:52.779590 +02:00 < Date: Mon, 13 May 2024 16:03:52 GMT
DEBUG 2024-05-13 18:03:52.779684 +02:00 < Content-Type: text/html
DEBUG 2024-05-13 18:03:52.780341 +02:00 < Content-Length: 192
DEBUG 2024-05-13 18:03:52.780429 +02:00 < Connection: close
DEBUG 2024-05-13 18:03:52.781211 +02:00 response status: 413
DEBUG 2024-05-13 18:03:52.781236 +02:00 body:

<title>413 Request Entity Too Large</title>

413 Request Entity Too Large


nginx/1.18.0 (Ubuntu)

error: API request failed
caused by: sentry reported an error: unknown error (http status: 413)
INFO 2024-05-13 18:03:52.785082 +02:00 Skipping update nagger update check`

Here is our Sentry configuration
dexguardEnabled.set(false) includeSourceContext.set(false) autoInstallation { enabled.set(true) sentryVersion.set("7.9.0") }

Expected Result

We should be able to successfully upload the proguard file.

Actual Result

Error 413 file too large when executing gradle task uploadSentryProguardMappings

hi @ravishaccedo

sentry.maissbt.com/api/0/projects/maissbt/sbt-android/files/dsyms

this looks like you're using a self-hosted version of Sentry. In this case I'd recommend checking with your infra team if you got enough storage for proguard mappings. I know of some customers that are uploading 500MB+ files just fine on sentry.io, so it must be something with your self-hosted version I believe.

The relay docs also mention a file upload size limit, maybe that's the one you're hitting?

Thanks @romtsn
I hav reached out to the admin of the self hosted sentry and i am waiting for a response.

Could be a limit issue rather than a space issue?

Basically for self hosted sentry is it possible to define limits for proguard files. If yes, which configuration do we need to update?

Yeah, I think you can try to tweak the following config - limits.max_api_chunk_upload_size and limits.max_api_file_upload_size. They are a part of the Relay config, you can see the limits in the docs that @markushi linked above.

Thanks @romtsn and @markushi
I have raised the issue with the owner of the self hosted sentry. Not sure if there was a need for them to decrease the default limits. If default limits have been in place the file of 11 MB should have uploaded successfully.

I will close this issue and open another if we still face challenges with the file upload.