Closed nathantqn closed 4 years ago
@nenjamin2405 (and anyone else who runs into this) - Currently, your best option is to strip the dist
value from the event in beforeSend
:
Sentry.init({
dsn: 'YOUR DSN',
beforeSend: (event, hint) => {
delete event.dist;
return event;
},
});
I'm facing with a same issue.
I can see the release artifacts with the same release name as issues have, but the source map is not applied.
The DISTRIBUTION column of the artifact is None
(and as @nenjamin2405 says there is no option on sentry-cli to set it), so I've stripped the dist
parameter from the event (referring to @lobsterkatie), but still the source map is not applied.
Edit Sorry, this finally worked. My problem was simply the release name was different between issues and artifacts. My working codes:
$ SENTRY_PROPERTIES=./ios/sentry.properties npx sentry-cli react-native appcenter --deployment Staging --bundle-id com.myapp.dev --version-name $npm_package_version MyApp ios ./build/ios/CodePush
$ SENTRY_PROPERTIES=./ios/sentry.properties npx sentry-cli react-native appcenter --deployment Production --bundle-id com.myapp --version-name $npm_package_version MyApp ios ./build/ios/CodePush
Sentry initialization
...
await Sentry.init({
dsn: '***',
environment: Config.ENV,
beforeSend(event: Sentry.Event) {
delete event.dist;
return event;
}
});
if (Context.bundleLabel !== BUNDLE_NO_LABEL) {
Sentry.setRelease(
`${Context.appBundleId}-${Context.appVersion}-codepush:${Context.bundleLabel}`
);
}
...
Hi @lobsterkatie. thanks for your suggestion, but the thing is, whenever I release a new build for both iOS and Android on production, Sentry automatically upload the source map with the dist
option so if I get rid of the dist
in all Sentry events then again I cannot map them together, so in summary, there are 2 cases:
I initially release the build on Production (without any Codepush at that time), so the source map uploaded will have both version name and dist --> every time user has a problem in the app, Sentry will send the error event with both version and dist so that I can map them together, everything is fine in this case.
I refine some javascript code in my app, publish a codepush update, after the codepush command is finished, the sentry-cli uploads new source map, but the source map is missing dist
, then later on, every user whose app has been updated via Codepush and has issue in the app, the Sentry still send both version and dist as usual, but the codepush source map now doesn't have dist
--> cannot map
Any idea on this :(
Based on the above two comments I've tried configure sentry to conditionally drop the dist
field (i.e only when we know we're running a codepush update) but it seems the source maps still dont lineup for codepushed bundles even when the events have the correct release name and no dist property.
Has anyone been able to get this to work?
@nenjamin2405 - the above should do what you need (and allow you to stop stripping dist
values in beforeSend
). Can you please let me know if you're still running into problems?
Hi @HazAT, currently I'm facing a problem of
Source code was not found
in Urlapp:///index.android.bundle
. I'm using Sentry together with Codepush, after using the command:sentry-cli react-native appcenter --deployment Staging MyAppName android ./build/android/CodePush
In
the Artifacts tab,
index.android.bundleand
index.android.bundle.mapwere uploaded but the
Distributionfields are
None. But my error includes both
release_nameand
dist`, so it cannot map with those artifacts.So my question is: How can I resolve this? I cannot find --dist as an option in sentry-cli react-native appcenter -h. I already tried to use --dist but it's not a valid option.
Originally posted by @nenjamin2405 in https://github.com/getsentry/sentry-react-native/issues/612#issuecomment-534402454