getsentry / sentry-react-native

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

[ANDROID] - Adding source map references error: could not parse JSON response #416

Closed abrel closed 6 years ago

abrel commented 6 years ago

OS:

Platform:

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

v8.4.0
4.0.5
├── axios@0.15.3
├── card-validator@4.3.0
├── color@2.0.1
├── es6-symbol@3.1.1
├── humps@2.0.1
├── immutable@3.8.2
├── instabug-reactnative@2.11.1
├── invariant@2.2.3
├── ios-deploy@1.9.2
├── lodash@4.17.5
├── lottie-react-native@2.3.2
├── moment@2.20.1
├── moment-timezone@0.5.14
├── normalizr@3.2.4
├── prop-types@15.6.1
├── UNMET PEER DEPENDENCY react@16.3.1
├── UNMET PEER DEPENDENCY react-dom@16.3.0-alpha.1
├── react-native@0.55.3
├── react-native-adjust@4.12.0 invalid
├── react-native-animatable@1.2.4
├── react-native-background-upload@4.4.0
├── react-native-calendar-events@1.5.0
├── react-native-carrier-info@1.0.1
├── react-native-code-push@5.3.2
├── react-native-contacts@2.1.1
├── react-native-country-picker-modal@0.5.1
├── react-native-device-info@0.13.0
├── react-native-document-picker@2.1.0
├── react-native-fabric@0.4.1
├── react-native-fetch-blob@0.10.8
├── react-native-firebase@3.2.7
├── react-native-gifted-chat@0.3.0
├── react-native-htmlview@0.12.1
├── react-native-i18n@2.0.12
├── react-native-image-crop-picker@0.20.1
├── react-native-keep-awake@2.0.6
├── react-native-keyboard-aware-scroll-view@0.5.0
├── react-native-keychain@2.0.0-rc
├── react-native-navstack@0.0.3
├── react-native-pdf@2.0.7
├── react-native-permissions@1.1.1
├── react-native-phone-input@0.1.10
├── react-native-picker@4.3.5
├── react-native-progress@3.4.0
├── react-native-router-flux@3.43.0
├── react-native-sentry@0.37.0
├── react-native-share@1.0.23
├── react-native-smooch@1.0.1
├── react-native-sms@1.5.2
├── react-native-star-rating@1.0.9
├── react-native-store-review@0.1.5
├── react-native-swiper@1.5.13
├── react-native-touch-id@4.0.1
├── react-native-ux-cam@4.4.0
├── react-native-vector-icons@4.5.0
├── react-native-version-check@3.0.0-rc.5
├── react-redux@5.0.7
├── redux@3.6.0
├── redux-form@6.8.0
├── redux-logger@3.0.6
├── redux-persist@4.10.2
├── redux-persist-transform-filter@0.0.10
├── redux-persist-transform-immutable@4.3.0
├── redux-promise@0.5.3
├── redux-saga@0.14.8
├── redux-thunk@2.1.2
├── socket.io-client@2.0.4
├── tipsi-stripe@4.6.3
├── urijs@1.19.1
└── uuid@3.2.1

Config:

Sentry.config('https://...@sentry.io/...', {
   ignoreUrls: [/XXX\.io/, /localhost/],
}).install()

I have following issue:

I am not able to build in release mode with android due to a sourcemap issue

Processing react-native sourcemaps for Sentry upload.
> Analyzing 2 sources
> Rewriting sources
> Adding source map references
error: could not parse JSON response
  caused by: missing field `version` at line 1 column 35
:app:bundleDevReleaseJsAndAssets FAILED

FAILURE: Build failed with an exception.

Steps to reproduce:

Expected result:

amed commented 6 years ago

I assume that your OS has no sentry-cli, can you check that?

The other alternative is to use cli.executable=node_modules/sentry-cli-binary/bin/sentry-cli in your android/sentry.properties

jordoh commented 6 years ago

I'm seeing the same error with Appcenter builds of both iOS and Android platforms:

Android

Processing react-native sourcemaps for Sentry upload.
> Analyzing 2 sources
> Rewriting sources
> Adding source map references
error: could not parse JSON response
  caused by: missing field `version` at line 1 column 36
:app:bundleReleaseJsAndAssets FAILED

iOS

Processing react-native sourcemaps for Sentry upload.
> Analyzing 2 sources
> Rewriting sources
> Adding source map references
error: could not parse JSON response
  caused by: missing field `version` at line 1 column 36

Relevant sentry packages for both builds:

├─ @sentry/cli@1.32.2
├─ @sentry/wizard@0.9.7
├─ react-native-sentry@0.36.0

This issue is preventing releases, for now I suppose I will disable Sentry sourcemap uploads

HazAT commented 6 years ago

@abrel Are you also using appcenter?

I just tried it with a clean project

react-native init Test
cd Test
yarn add react-native-sentry
react-native link
react-native run-ios

everything worked as expected.

├── react@16.3.1
├── react-native@0.55.4
└── react-native-sentry@0.37.1
victormartingarcia commented 6 years ago

Just for the record, I am experiencing this issue as well

Processing react-native sourcemaps for Sentry upload.
> Analyzing 2 sources
> Rewriting sources
> Adding source map references
error: could not parse JSON response
  caused by: missing field `version` at line 1 column 32
HazAT commented 6 years ago

We are looking into that issue right now, we are not able to reproduce it yet though.

HazAT commented 6 years ago

Can you guys please prefix the command you are running in your shell with

SENTRY_LOG_LEVEL=debug ...

and post / send the output to daniel@sentry.io ?

victormartingarcia commented 6 years ago

Output sent to daniel@sentry.io :)

HazAT commented 6 years ago

@victormartingarcia Thanks this was very helpful, we are almost certain we know what the issue now. I will keep you guys posted.

victormartingarcia commented 6 years ago

@HazAT any suggestion for a dirty fix that let me move on in the meantime?

Right now we cannot build any release version of the app because of this. Well, wecould do that removing react-native-sentry reference for both our android/ios projects, but it's a bummer ;)

HazAT commented 6 years ago

@victormartingarcia Can you please confirm that to content of sentry.properties are the same with the org and project slug on sentry.io? I suspect it's because you renamed your project/org after you setup your project.

victormartingarcia commented 6 years ago

@HazAT that's exactly what was happening 😅😅

I've renamed the project and didn't changed it on sentry.properties. Now it works like a charm, thanks!!

Is there any way to override this value on execution time? (ENV var or alike) I'm using fastlane for assembling multiple applications from same android studio project

It is, as shown in the docs ;) https://docs.sentry.io/learn/cli/configuration/

menasameh commented 6 years ago

@HazAT thanks man, you saved my life 😂😂 I forgot to change the name in sentry.properties 😅

HazAT commented 6 years ago

While I know it's kind of a bad error message we return on the server, I consider this as fixed/not a bug. Please if you run into this check: https://github.com/getsentry/react-native-sentry/issues/416#issuecomment-395723975

Closing this now.