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.

app.json

{
  "extra": {
    "bugsnag": {
      "apiKey": "YOUR_API_KEY"
    }
  }
}

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

App.js

Import and start the Bugsnag client as early as possible:

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

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.

Release tracking and source map upload

To notify Bugsnag of releases and upload source maps so that you’ll see full stacktraces, you’ll need to add one of the following build hooks, depending on the type of Expo build you are using:

EAS Build

For EAS Build, we provide an Expo config plugin. To tell Expo to use this config plugin in your application builds, install the plugin as follows:

expo install @bugsnag/plugin-expo-eas-sourcemaps

The Bugsnag plugin for EAS Build supports Expo SDK 45+ only.

Then insert the following into your app.json:

{
  "expo": {
    "extra": {
      "bugsnag": {
        "apiKey": "YOUR_API_KEY"
      }
    },
    "plugins": ["@bugsnag/plugin-expo-eas-sourcemaps"]
  }
}

Once this configuration is in place, every time you build a standalone app (eas build) your release will be reported to Bugsnag, along with its source maps.

Classic Expo build

If you are using the classic Expo build service, we provide a postPublish hook. To tell Expo to use this hook in your app, 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.