bubblewrap icon indicating copy to clipboard operation
bubblewrap copied to clipboard

Sentry integration

Open hadifarnoud opened this issue 4 years ago • 6 comments

Is there a way to integrate Sentry into the TWA app generated?

sometimes the web app fails to load and I'd like to know why from browser side of TWA. I already have Sentry on my web app

hadifarnoud avatar Dec 27 '21 11:12 hadifarnoud

The app will mostly be running in the user's browser, and I don't think you can set up Sentry to get crash/debug info for the user's browser.

If there's something going wrong before the browser is launched, then you should be able to do that. We don't have a plugin for this, but you may be able to get it to work by modifying the generated project.

PEConn avatar Jan 11 '22 14:01 PEConn

the app will have its own Sentry integration, the issue is every time I regenerate the app, the changes will be written over. If it's not that difficult, why not add Sentry to bubblewrap?

there are lots of issues that cannot be logged if there is no Sentry. Like ssl issue for example or anything that prevents the browser loading the app. I can't see what went wrong.

I did add sentry manually but the data I get is limited

hadifarnoud avatar Jan 21 '22 13:01 hadifarnoud

To be clear, I don't know how difficult this is going to be, I've never used Sentry. Could you share the changes you've been making manually to the app?

"I did add Sentry manually but the data I get is limited" - are you implying that if Sentry is added into bubblewrap (as opposed to being added manually after the project is generated) that you'll get better data?

PEConn avatar Feb 10 '22 14:02 PEConn

Sorry I thought we did have it but it was our custom app that had Sentry. We have not managed to do this for Bubblewrap

hadifarnoud avatar Mar 16 '22 07:03 hadifarnoud

Adding sentry is pretty simple (https://docs.sentry.io/platforms/android/):

# app/build.gradle
repositories {
+    mavenCentral()
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.3.0'
+    implementation 'io.sentry:sentry-android:5.2.3'
}
# app\src\main\AndroidManifest.xml
<manifest>
    <application>
+      <meta-data
+          android:name="io.sentry.dsn"
+          android:value="YOUR_SENTRY_DSN" 
+      />
    </application>
</manifest>

This will log all erros that happen directly in the application. I don't know if it will log errors in the browser, probably it won't. I don't think the data will be better when added somewhere deeper.

6a616e avatar Apr 11 '22 13:04 6a616e

Thank you.

This will log all erros that happen directly in the application. I don't know if it will log errors in the browser, probably it won't. I don't think the data will be better when added somewhere deeper.

I'm hoping to get connection errors in Sentry. if for any reason browser can't connect to the webapp, I can't get errors from sentry I put in my webapp. I thought I should explain why it is needed

hadifarnoud avatar Apr 20 '22 07:04 hadifarnoud