How does sentry resolve source map when upload as artifacts

The problem we have is that we’re trying to build a react native bundle with sourcemap and upload the source map file to sentry while storing the bundle file on user’s devices. But the stack trace received on sentry can not find the sourcemap. I’ve seen there are quite a few other questions related to this, but still the cause is not very clear. Can someone explain a bit how does sentry do the resolving so we may figure out what we did wrongly.

Firstly, I’m curious about how does sentry know the sourceMappingUrl, since the source bundle is only on user’s device, sentry won’t be able to get the source bundle.

Secondly, if sentry manage to get the sourceMapUrl somehow, how will it match this with the artifacts uploaded? In our case, the sourceMapUrl is something like ‘~/bundle.map’ and the sourcemap uploaded is named ‘~/bundle.map’ also, is this expected?

thanks in advance!

On react-native you need to use the react-native-sentry client which will rewrite the URLs before event submission into a format we can associate in a platform independent way. That URL (app:///index.ios.bundle or something like this) + your release name + your distribution id is then looked up in the artifact storage.

The sentry-cli tool will upload the sourcemaps accordingly. Additionally a reference is stored with the minified bundle to point to the sourcemap.

sourceMapUrl is not used for react-native.

Note that none of this will work if you try to use this with raven-js itself. So you always need to go through react-native-sentry.

Please do not attempt to manually upload sourcemaps (use the build step integration) as manual uploads will not get this set up correctly.

Ah, I see, thank you, we will integrate the react-native-sentry client then. By the way, is the android client ready to integrate already, since currently the document is not covering android at all.

Yes. We updated the docs today to reflect that.