getsentry / sentry-react-native

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

Upload Debug Symbols to Sentry Fails With 405 #181

Closed palmm closed 7 years ago

palmm commented 7 years ago

Hey - building my iOS project, Sentry fails to upload debug symbols with a 405. Occurs in both debug and release configs.

The error is: Debug symbol upload failed

Digging deeper, the logs are:

Batch 1
> Found 1 debug symbol files. Checking for missing symbols on server
error: http error: generic error (405)

Dependencies:

react-native@0.47.1
react@16.0.0-alpha.12
sentry-cli-binary@1.18.0
react-native-sentry@0.15.1

I have tried un-linking and re-linking and, since I use NVM, I tried changing the Bundle React Native code and images script to the one referenced here: https://docs.sentry.io/clients/react-native/manual-setup/#build-steps.

I feel like this might be a problem on my end with the DSN, slug, organization or API key but errors are still being logged in my sentry dashboard and all is swell otherwise.

HazAT commented 7 years ago

Hey, Can you add --log-level=debug to the sentry-cli command and paste the result so we can see what is happening?

export SENTRY_PROPERTIES=sentry.properties
../node_modules/sentry-cli-binary/bin/sentry-cli --log-level=debug upload-dsym
palmm commented 7 years ago

The log output is the following:

[INFO] sentry_cli::commands::upload_dsym Scanning /Users/USER/Library/Developer/Xcode/DerivedData/APP/Build/Products/Debug-iphonesimulator/APP.app.dSYM
Batch 1
> Found 1 debug symbol files. Checking for missing symbols on server
[INFO] sentry_cli::commands::upload_dsym Checking for missing debug symbols: [
    DSymRef {
        arc_name: "DebugSymbols/Contents/Resources/DWARF/APP",
        checksum: "CHECKSUM",
        size: SIZE,
        uuids: [
            Uuid("UUID")
        ]
    }
]
[INFO] sentry_cli::api request GET https://sentry.io/api/ID/csp-report/?sentry_key=KEY/api/0/projects/SLUG/PROJECTNAME/files/dsyms/unknown/?checksums=CHECKSUM
[INFO] sentry_cli::api using token authentication
[INFO] sentry_cli::api > GET /api/ID/csp-report/?sentry_key=KEY/api/0/projects/SLUG/PROJECTNAME/files/dsyms/unknown/?checksums=CHECKSUM HTTP/1.1
[INFO] sentry_cli::api > Host: sentry.io
[INFO] sentry_cli::api > Accept: */*
[INFO] sentry_cli::api > User-Agent: sentry-cli/1.18.0
[INFO] sentry_cli::api > Authorization: Bearer fb65e26e***
[INFO] sentry_cli::api < HTTP/1.1 405 METHOD NOT ALLOWED
[INFO] sentry_cli::api < Server: nginx
[INFO] sentry_cli::api < Date: Sun, 13 Aug 2017 21:01:14 GMT
[INFO] sentry_cli::api < Content-Type: text/html; charset=utf-8
[INFO] sentry_cli::api < Content-Length: 0
[INFO] sentry_cli::api < Connection: keep-alive
[INFO] sentry_cli::api < X-XSS-Protection: 1; mode=block
[INFO] sentry_cli::api < X-Content-Type-Options: nosniff
[INFO] sentry_cli::api < Content-Language: en
[INFO] sentry_cli::api < Expires: Sun, 13 Aug 2017 21:01:14 GMT
[INFO] sentry_cli::api < Vary: Accept-Language, Cookie
[INFO] sentry_cli::api < Last-Modified: Sun, 13 Aug 2017 21:01:14 GMT
[INFO] sentry_cli::api < Allow: POST
[INFO] sentry_cli::api < Cache-Control: max-age=0
[INFO] sentry_cli::api < X-Frame-Options: deny
[INFO] sentry_cli::api < Content-Security-Policy: default-src *; script-src 'self' 'unsafe-eval' 'unsafe-inline' e90d271df3e973c7.global.ssl.fastly.net cdn.ravenjs.com assets.zendesk.com ajax.googleapis.com ssl.google-analytics.com www.googleadservices.com analytics.twitter.com platform.twitter.com *.pingdom.net js.stripe.com statuspage-production.s3.amazonaws.com s3.amazonaws.com *.google.com www.gstatic.com aui-cdn.atlassian.com www.hipchat.com *.atlassian.net *.jira.com *.zopim.com; font-src * data:; connect-src * wss://*.zopim.com; style-src 'self' 'unsafe-inline' e90d271df3e973c7.global.ssl.fastly.net s3.amazonaws.com aui-cdn.atlassian.com www.hipchat.com fonts.googleapis.com; img-src * data: blob:; report-uri https://sentry.io/api/54785/csp-report/?sentry_key=KEY&sentry_release=RELEASE
[INFO] sentry_cli::api < X-Served-By: web-0df6213e
[INFO] sentry_cli::api < Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
[INFO] sentry_cli::api response: 405
[INFO] sentry_cli::api body: 
error: http error: generic error (405)

I was a little heavy handed with the censoring, let me know if you need any of those details. Looks like I might be using the wrong DSN or endpoint?

Cheers

HazAT commented 7 years ago

@palmm Can you make sure the defaults.url in your sentry.properties looks something like this: defaults.url=https://sentry.io/

If it's still not working, please send me the unredacted output to daniel@sentry.io

palmm commented 7 years ago

@HazAT

I have defaults.url=https://sentry.io/api/ID/csp-report/?sentry_key=KEY. Will send you the properties file and output.

HazAT commented 7 years ago

please change it to: defaults.url=https://sentry.io/ this should fix it.

jonathanroze commented 7 years ago

I've almost the same error but the HTTP error is 404 ! Can i sent you my ouput?

HazAT commented 7 years ago

@Clowning Yes go ahead.

palmm commented 7 years ago

Setting defaults.url=https://sentry.io/ fixed the errors for me. Thanks @HazAT

phillipj commented 7 years ago

Just want to share a similar experience I had, in case someone else experiences something similar to this.

Since the auth token needed to upload symbols, is related to a Sentry account, rather than a project, I've created a "service account" for this sole purpose. This account was made an Sentry organization "member".

As soon as I started using that service account to upload symbols, I saw a very similar error like the OP posted, expected I got 403 rather than 405.

As soon as I made the service account an organization "admin", everything worked as expected 🎉