Skip to content

[CHORE] Bugsnag logging setup#1096

Closed
IlarionHalushka wants to merge 27 commits intoRocketChat:developfrom
IlarionHalushka:chore-add-bugsnag
Closed

[CHORE] Bugsnag logging setup#1096
IlarionHalushka wants to merge 27 commits intoRocketChat:developfrom
IlarionHalushka:chore-add-bugsnag

Conversation

@IlarionHalushka
Copy link
Copy Markdown
Contributor

@IlarionHalushka IlarionHalushka commented Aug 1, 2019

@RocketChat/ReactNative
Closes #123

This PR aims to add error logging using Bugsnag.

Bugsnag provides ability to upload source maps for each build in order to be able to see an informative stack trace.

  • basic configuration of bugsnag
  • upload iOS source maps in ios-build CI job
  • upload Android source maps in android-build CI job
  • exchange firebase error logging to bugsnag
  • add to Settings Send crash reports switch which enables\disables reports\analytics sending.
  • change API key from Ilarion's to RocketChat's and test error reporting on release builds

Screenshots of error stack trace on Bugsnag:
Screen Shot 2019-08-01 at 10 59 35 PM

Uploaded source maps (release via CI, debug from local machine):
Screen Shot 2019-08-02 at 11 01 44 AM

@IlarionHalushka IlarionHalushka changed the title [WIP][CHORE] initial bugsnag setup [CHORE] Bugsnag logging setup Aug 2, 2019
name: Upload sourcemaps to Bugsnag
command: |
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android-release.bundle --sourcemap-output android-release.bundle.map
curl https://upload.bugsnag.com/react-native-source-map -F apiKey=72a0364cb361fc8f0fdc6cbf605f9963 -F appVersionCode=$CIRCLE_BUILD_NUM -F dev=false -F platform=android -F [email protected] -F [email protected] -F projectRoot=app.bugsnag.com/rocketchat-1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to change this API Key

name: Upload sourcemaps to Bugsnag
command: |
react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ios-release.bundle --sourcemap-output ios-release.bundle.map
curl https://upload.bugsnag.com/react-native-source-map -F apiKey=72a0364cb361fc8f0fdc6cbf605f9963 -F appBundleVersion=$CIRCLE_BUILD_NUM -F dev=false -F platform=ios -F [email protected] -F [email protected] -F projectRoot=app.bugsnag.com/rocketchat-1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to change this API key

<data android:mimeType="*/*" />
</intent-filter>
</activity>
<meta-data
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API key

index.js Outdated
import { Client } from 'bugsnag-react-native';
import { name as appName, share as shareName } from './app.json';

const bugsnag = new Client('72a0364cb361fc8f0fdc6cbf605f9963');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API Key.
Is it ok to use it here or should we hide from Github?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sensitive info of users can't be accessed using API key so I think it should stay

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move this to some separate config file just to not keep API Keys within source code. Also you should consider if you want to get bug reports from apps that are forks of this app especially when they won't share the sources.

@IlarionHalushka
Copy link
Copy Markdown
Contributor Author

IlarionHalushka commented Aug 3, 2019

I had to remove the description of an error like log('err_on_login', e); like it used to be with firebase logging. The change is made because bugsnag.notify accepts only 1 parameter of type Error.

Fortunately bugsnag groups errors by lines where they occurred like this:
Screen Shot 2019-08-03 at 9 51 15 PM

@IlarionHalushka IlarionHalushka mentioned this pull request Aug 7, 2019
5 tasks
# Conflicts:
#	.circleci/config.yml
#	android/build.gradle
#	app/views/SettingsView/index.js
#	ios/Podfile
#	ios/RocketChatRN.xcodeproj/project.pbxproj
#	package.json
#	yarn.lock
@IlarionHalushka
Copy link
Copy Markdown
Contributor Author

Source maps are successfully uploaded to bugsnag during latest builds:
Screen Shot 2019-08-11 at 3 02 46 PM

config.js Outdated
@@ -0,0 +1,3 @@
export default {
BUGSNAG_API_KEY: '72a0364cb361fc8f0fdc6cbf605f9963'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a task on CI to replace this key and other places?
What will happen if we commit with BUGSNAG_API_KEY: ''?
Will it compile?
I'm thinking in DX here.
We shouldn't enforce anyone to have a Bugsnag profile in order to compile our app, but it would be better if we left that empty and replace on build time.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot test it because my bugsnag account trial has expired :(
When I change BUGSNAG_API_KEY to '' then build doesn't fail but I'm not sure if whether it still sends requests to bugsnag.

@IlarionHalushka
Copy link
Copy Markdown
Contributor Author

Closed due to new opened PR: #1145

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add some error tracking like crashlytics or bugsnag

3 participants