bugsnag / bugsnag-expo

MIT License
11 stars 5 forks source link

Make Bugsnag Source Map Upload Work With EAS Update #48

Open thorbenprimke opened 2 years ago

thorbenprimke commented 2 years ago

Description

I had to push a quick bug fix via EAS Update but now the source maps no longer work - or at least another runtime exception logged after the update does not have the sources mapped.

Describe the solution you'd like When one runs

eas update --branch production --message 'Updating the app'

upload the source maps.

luke-belton commented 2 years ago

Hi @thorbenprimke - we have an item on our backlog to add support for EAS Update in the future. I don't have an exact timescale for that at the moment, but I'll make sure that we keep this thread updated on progress 👍

stephenlaughton commented 2 years ago

hey @luke-belton any news on this? EAS updates is now in GA and many more users are using it. if ETA is somewhat far away can you point us to documentation that we can use to develop a workaround in the meantime?

foolem commented 2 years ago

+1

evelant commented 2 years ago

EAS update is now the "official" way to deploy updates to Expo apps. @luke-belton could you provide a workaround for us to use until this is ready?

Hopefully this can get prioritized since it will impact almost every expo user going forward.

stephenlaughton commented 2 years ago

agreed. i already posted above @luke-belton but this is a really huge issue for us right now and looking into the upload code provided in the repo it is a bit of a jungle of gradle and shell scripts across each platform.

can you point us to a simple API call that can be made manually to get sourcemaps up on bugsnag? a CURL command? anything would be useful at this point. i can't see bugsnag being viable for expo users moving forward unless this is solved.

edit: i see this is labelled as backlog and feature request. this really should be an urgent bug unless expo support is not a priority, in which case it will be easier to look for other options.

luke-belton commented 2 years ago

Hi all - thanks for your thoughts on this and apologies for the delayed update. There are still some ongoing discussions internally on how best to support this, as well as some potential constraints around the current eas update command in terms of uploading source maps.

We hope to resolve these and also provide a recommendation for a manual approach in the interim - I’ll do my best to get an update out on this thread as soon as possible, hopefully by the end of the week :+1:

luke-belton commented 2 years ago

Hi - thanks for your patience on this. Currently, EAS Update doesn't have a hook that's suitable for getting a unique ID with each update.

At this stage, we'd therefore recommend bumping your app version each time you run the eas update command. You should then be able to use a command similar to the following after running the update to upload your source maps to Bugsnag, noting that you'll need to use the same app version in your Bugsnag configuration code and your source map upload:

bugsnag-source-maps upload-react-native \
    --api-key <YOUR_API_KEY> \
    --platform android \
    --app-version <YOUR_APP_VERISON> \
    --source-map "./dist/bundles/$(ls ./dist/bundles | grep "android.*.map")" \
    --bundle "./dist/bundles/$(ls ./dist/bundles | grep "android.*.js")"

You can replace android with ios in the above code to upload your iOS maps/bundles.

As stated above, we are looking to add official support for EAS Updates, which will hopefully be possible in the near future once it has a hook or similar that we can use to get what we need on each update.

Let me know if you have any questions about this approach 👍

greis commented 2 years ago

@luke-belton Not sure if it's the same issue or not but I'm using EAS Update with Expo Go and I tried to manually upload the source maps with the bugsnag-source-maps upload-react-native command but the source maps didn't work. Do you know if this something that only works with EAS builds or if it should work on Expo Go as well?

luke-belton commented 2 years ago

Hi @greis - apologies for the slow response on this. In my testing I've been able to get sourcemaps working as expected using the method outlined above, running the update in Expo Go.

Could you possibly write into support@bugsnag.com with links to events in Bugsnag that are failing to map so that we can investigate this for you please?

johnkiely1 commented 2 years ago

Hi @greis, have you managed to make any progress with this? Are you sourcemaps working as expected now?

thorbenprimke commented 1 year ago

@luke-belton - just wanted to let you know that the snippet you shared seems to work as expected. I've used it for a few OTA updates and any new crashes show the expected stack traces.

Thanks!

kennethlynne commented 1 year ago

I was very confused how to get source maps. The expo docs are very confusing on the topic (see https://github.com/expo/expo/issues/19934) and the bugsnag docs say that we only get source maps for release builds whatever that means. The CLI supports dumping source maps already (see https://github.com/expo/eas-cli/commit/7ebb547fd9e8ab2ef2d7e85c40a34067352fcc3a).

Sentry makes this seemingly super easy and configurable (see https://docs.expo.dev/guides/using-sentry) so I hope bugsnag can adopt a similar approach and help out on the bugsnag expo docs.

I will however try out the workaround suggested, which was very much appreciated :)

johnkiely1 commented 1 year ago

Hi @kennethlynne. The docs as provided by Expo are managed by Expo and seem to be a combination of wording used by them and a copy of some of the Bugsnag Expo documentation. I believe this was created prior to EAS support so arguably omits some of the relevant information. I'm sure you've already seen the official Bugsnag installation docs here. This amounts to an additional plugin for sourcemap uploads on EAS builds which will also get automatically installed if the Bugsnag Expo installation cli is used. This should automatically upload source maps for release (non-development) builds.

To try to add some clarity around the release/development distinction I believe it is covered here from an EAS build perspective.

Hope that helps.

jameswagoner commented 1 month ago

Bumping since this has been open for about 2 years now.

EAS Update creates hbc bundles with Expo SDK 50. While manually upload works, source maps are not applied since my guess is they are not js files any more.

Any updates here in the last 2 years??

clr182 commented 1 month ago

Hi @jameswagoner

Unfortunately we do not have an update to share at this moment in time. This is still on our backlog to complete when priorities allow. Once we have more information to share we will be sure to update you via this thread.