Manual integration guide

Integrate Bugsnag into your Expo app without using the CLI.

Installation

As of version 44, the Bugsnag Expo package (@bugsnag/expo) is versioned to match the Expo SDK version for which it provides support. This means that our package is actively supported while the equivalent version of the Expo SDK is supported. When support for an Expo SDK is dropped, we will also drop support for that version of @bugsnag/expo. A list of supported SDK versions can be found on the “Upgrading Expo SDK” page.

Expo SDK 44+

Install the @bugsnag/expo version that matches the Expo SDK version you are using. For example, if you’re using Expo SDK 44 install @bugsnag/expo@44.0.0

expo install @bugsnag/expo@^44.0.0

Ensure the @bugsnag/expo dependencies are installed:

expo install @react-native-community/netinfo 
expo install expo-application expo-constants expo-crypto expo-device expo-file-system

Expo SDK 43 and earlier

Support for versions for the Expo SDK older than 44 are in the 6.x and 7.x series of packages, you should install one of the following packages with your preferred npm client, adding it to your dependencies:

Expo SDK @bugsnag/expo
43 7.14.2
42 7.13.2
40/41 7.11.0
39 7.5.5
38 7.3.5
37 7.1.1
36 6.5.3
<= 35 6.4.4

Documentation for v6.x can be found on our legacy pages.

Basic configuration

We recommend putting your API key in app.json and having Bugsnag pick it up automatically. In this location the postPublish hook will pick up too.

app.json

{
  "extra": {
    "bugsnag": {
      "apiKey": "YOUR_API_KEY"
    }
  }
}
import Bugsnag from '@bugsnag/expo'
Bugsnag.start()

You can find your API key in Project Settings from your Bugsnag dashboard.

Alternatively you can configure Bugsnag by providing your API key as a string:

import Bugsnag from '@bugsnag/expo'
Bugsnag.start('YOUR_API_KEY')

To specify any additional configuration options, supply an object instead:

Bugsnag.start({
  otherOptions: value
})

See configuration options for more information.

Post-publish hook

To notify Bugsnag of releases, and to upload source maps so that you’ll see full stacktraces, we provide a postPublish hook specifically for Expo.

To tell Expo to use this hook in your application, insert the following into your app.json:

{
  "expo": {
    "extra": {
      "bugsnag": {
        "apiKey": "YOUR_API_KEY"
      }
    },
    "hooks": {
      "postPublish": [
        {
          "file": "@bugsnag/expo/hooks/post-publish.js",
          "config": {
            /*

            For Bugsnag On-premise, the endpoints for each of
            the hook's components will need to be set:

            "sourceMapUploader": { "endpoint": "https://bugsnag-upload.example.com" },
            "buildReporter": { "endpoint": "https://bugsnag-builds.example.com" }

            */
          }
        }
      ]
    }
  }
}

Once this configuration is in place, every time you publish (expo publish) or build a standalone app (expo build:ios|android) your release will be reported to Bugsnag, along with its source maps.