Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcemaps of self-hosted bundles not resolved #145

Closed
peter-jozsa opened this issue Sep 21, 2020 · 11 comments
Closed

Sourcemaps of self-hosted bundles not resolved #145

peter-jozsa opened this issue Sep 21, 2020 · 11 comments

Comments

@peter-jozsa
Copy link

Hey there,

We are trying to use Sentry in our self-hosted managed Expo app but unfortunately sourcemaps are not resolved when an issue is reported. We upload sourcemaps of the bundle in postExport hook like it is suggested in the docs, but Sentry does not use them.

The main reason for this is because hardcoded Expo CDN url is used to determine how frame filenames should be normalized. Since our app does not use the Expo CDN url the original frame filename is sent along the issue and Sentry won't find the uploaded sourcemaps.

We could easily workaround the issue by adding the RewriteFrames integration explicitly to the Sentry.init call, like:

Sentry.init({
  dsn: SENTRY_DSN,
  enableInExpoDevelopment: true,
  integrations: [
    new RewriteFrames({
      iteratee: (frame) => {
        if (frame.filename) {
          frame.filename = `app:///main.${Platform.OS}.bundle`
        }
        return frame
      },
    }),
  ],
})

I think docs should mention how people should use this package when they don't use the Expo CDN to deploy their apps.

Hope I could help someone :)

@RodolfoGS
Copy link
Contributor

I have the same issue with self-hosted, the only difference is that I'm using Bare workflow (no Managed).

@peter-jozsa
Copy link
Author

Try the workaround I shared in my original issue description, it should work as is in bare workflow too.

@RodolfoGS
Copy link
Contributor

I need to import RewriteFrames from somewhere, how can I do?

ReferenceError: Can't find variable: RewriteFrames

@RodolfoGS
Copy link
Contributor

RodolfoGS commented Oct 3, 2020

I fixed Can't find variable: RewriteFrames installing @sentry/integrations

import { RewriteFrames } from '@sentry/integrations';

I applied your workaround but doesn't work for me, sentry can't found the sourcemaps.
I'm using sentry-expo: 3.0.0-rc3 and expo: 39.0.3, what version you have?

I also tested change the filename but doesn't work. I'm testing on iOS

frame.filename = `app:///main.jsbundle`

@RodolfoGS
Copy link
Contributor

This also happen on non self-hosted updated #149

@cruzach
Copy link
Contributor

cruzach commented Oct 22, 2020

hm yeah seems like we should use the same RewriteFrames whether or not the project is Expo hosted.

what we're trying to match here is the bundle filename, which should be the same whether you export or publish :
index.android.bundle.map for android, and main.jsbundle.map for iOS

@peter-jozsa is this on iOS, android, or both?

@cruzach
Copy link
Contributor

cruzach commented Oct 22, 2020

@RodolfoGS i believe this is unrelated to your issue in the bare workflow

@cruzach
Copy link
Contributor

cruzach commented Nov 24, 2020

added docs for this here- expo/expo@ded7182

@cruzach cruzach closed this as completed Nov 24, 2020
@peter-jozsa
Copy link
Author

sorry for not replying, I tested this only on iOS but I think it is also related to since the built-in RewriteFrames checks the CDN URL of expo which will never work for us who self-hosts their bundles.

@cruzach
Copy link
Contributor

cruzach commented Nov 24, 2020

@peter-jozsa are you saying you can't overwrite the default RewriteFrames integration? You should be able to do that

@peter-jozsa
Copy link
Author

No, everything is okay, our app works fine with the workaround I suggested in my original issue description. I just tried to reply to your earlier message 👍

Thanks for adding it to your docs!

hm yeah seems like we should use the same RewriteFrames whether or not the project is Expo hosted.

what we're trying to match here is the bundle filename, which should be the same whether you export or publish :
index.android.bundle.map for android, and main.jsbundle.map for iOS

@peter-jozsa is this on iOS, android, or both?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants