Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
react-native-sentry
Advanced tools
This is an early beta release that only supports iOS
Requirements:
react-native >= 0.41
brew install getsentry/tools/sentry-cli
)Sentry can provide mixed stacktraces, which means if your app happens to crash on the native side you will also see the last call from javascript.
If you don't have a react native project up and running follow this guide. https://facebook.github.io/react-native/docs/getting-started.html
Start with adding sentry and linking it:
$ npm install react-native-sentry --save
$ react-native link react-native-sentry
Open up your xcode project in the iOS folder, go to your project's target and change the "Bundle React Native code and images" build script. The script that is currently there needs to be adjusted as follows:
export SENTRY_ORG=YOUR_ORG_SLUG
export SENTRY_PROJECT=YOUR_PROJECT_SLUG
export SENTRY_AUTH_TOKEN=YOUR_AUTH_TOKEN
export NODE_BINARY=node
sentry-cli react-native-xcode ../node_modules/react-native/packager/react-native-xcode.sh
You can find the slugs in the URL of your project (sentry.io/your-org-slug/your-project-slug) If you don't have an auth token yet you can create an auth token here.
To also upload debug symbols you can add an additional line into the build step at the end:
sentry-cli upload-dsym
For working with bitcode and more advanced setups consult the main documentation on symbol handling.
Add sentry to your index.ios.js
:
...
import { Sentry } from 'react-native-sentry';
Sentry.config('Your DSN').install();
Sentry.activateStacktraceMerging(require('BatchedBridge'), require('parseErrorStack'));
...
Additionally you need to register the native crash handler in your AppDelegate.m
:
#import <React/RNSentry.h>
/* ... */
[RNSentry installWithRootView:rootView];
These are functions you can call in your javascript code:
import {
Sentry,
SentrySeverity,
SentryLog
} from 'react-native-sentry';
Sentry.setLogLevel(SentryLog.Debug);
Sentry.setExtraContext({
"a_thing": 3,
"some_things": {"green": "red"},
"foobar": ["a", "b", "c"],
"react": true,
"float": 2.43
});
Sentry.setTagsContext({
"environment": "production",
"react": true
});
Sentry.setUserContext({
email: "john@apple.com",
userID: "12341",
username: "username",
extra: {
"is_admin": false
}
});
Sentry.captureMessage("TEST message", {
level: SentrySeverity.Warning
}); // Default SentrySeverity.Error
// This will trigger a crash in the native sentry client
//Sentry.nativeCrash();
FAQs
Official Sentry SDK for react-native
The npm package react-native-sentry receives a total of 451 weekly downloads. As such, react-native-sentry popularity was classified as not popular.
We found that react-native-sentry demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.