rollbar/rollbar-react-native

Feature Request: Expo support

cdesch opened this issue · 9 comments

Add Expo support for rollbar monitoring.

Expo Feature Request: https://expo.canny.io/feature-requests/p/rollbar-exception-reporting

Because rollbar-react-native currently includes android and ios native code, Expo apps must eject to ExpoKit to use rollbar-react-native.

You can get it to work without ejecting, just use the normal rollbar package, not this one.

import Rollbar from "rollbar/src/react-native/rollbar";

then configure and use normally as the rollbar js docs explain

@dacevedo12 Thank you. I hadn't thought about this.

It looks like the user will still be responsible for uncaught error handling, which only appear in this repo:
https://github.com/rollbar/rollbar-react-native/blob/master/src/Rollbar.js#L31-L57

Adding those to the other entry point might be enough to make it a full js-only solution.

Hi @cdesch,

I have created a fork with the changes you would need to utilize Rollbar if you'd like to test it.

Please read this PR for some detail: rollbar/rollbar.js#859

I'd be happy to give you more information if you need on how to use it, but I have made the changes @waltjones described are needed to support catching all errors & unhandled rejections.

Could we build an unofficial step by step guide? @dacevedo12

Trying now to setup :)

Actually just did it:

import Rollbar from "rollbar/src/react-native/rollbar";

const rollbar = Rollbar.init({"accessToken": "my access token"});

console.log(rollbar.log("Log here"));

@poncianodiego That is good if you don't need to report uncaught exceptions/rejections.

If you need those, the JS configuration for rollbar-react-native now supports unejected, JS-only apps:

import { Client, Configuration } from 'rollbar-react-native'
const config = new Configuration('POST_CLIENT_ITEM_ACCESS_TOKEN', {
  logLevel: 'info'
});
const rollbar = new Client(config);

the JS configuration for rollbar-react-native now supports unejected, JS-only apps

Yes, it seems that version 0.9.0 already added some support for Expo apps: https://github.com/rollbar/rollbar-react-native/releases/tag/v0.9.0