Sentry API does not work

Seems like the Sentry API is not working with Expo. I have followed the instructions and get the following error;

Cannot set property 'enableInExpoDevelopment' of undefined

The implementation is as per instruction;

import Sentry from 'sentry-expo'

Sentry.enableInExpoDevelopment = true


Sentry is not defined if i console log it. I have also looked at sentry-expo index and it looks like the docs might be outdated. Sentry themselves seem to point to some new docs and the format is slightly different, using Sentry.init -

I’m not sure why you’re getting that error (that code works for me). Double-check packages.json and run yarn again to be sure. Regarding the difference in the Sentry docs, I do know the sentry-react-native library (which sentry-expo is based on) is using an older version of the Sentry JavaScript API. Documentation for the older API is available here: (it’s rather hard to find on its own). Until sentry-react-native is updated, sentry-expo will be using that older API.

I have actually just managed to get this running using the new Sentry info;

import * as Sentry from 'sentry-expo'

  dsn: 'https://thingy...',
  enableInExpoDevelopment: true, // @NOTE Remove this in Prop

I am running sentry-expo version 2.0.0 if that makes any difference. The above is working as expected, but does not match the docs (in expo);

  • uses .init instead of .config
  • enableInExpoDevelopment is in the init config/object
  • Sentry is imported as a wildcard

Not sure what this means for the expo docs?

1 Like

Ah! It does look like everything is just getting updated to the JS API from Sentry! The Expo 34 upgrade instructions say to use sentry-expo 1.13.0, which still uses the old API that’s in the Expo documentation. The one risk is that, if you’re on managed workflow, I guess it’s possible there’s something out-of-sync between the JS in the updated library and the older native code. I don’t think there’s a whole lot to the native Sentry code, and the JS API updates would be on the JS side, so… it might work just fine!

At any rate, if it doesn’t work fine, downgrading to 1.13.0 and using the old instructions should work.

Ah, i didn’t see the install version for sentry-expo - that would likely explain it!

I will continue with 2.0.0 and see if i come across any issues - thanks for the help :slight_smile:

1 Like

Hi! I tested sentry-expo@2.0.0 on an SDK 34 project before merging/publishing and all went well. I just deployed the docs a couple hours ago with the necessary updates

Anyways- you should be good using v2.0.0 with SDK 34 :smile:


Does this mean that sentry-expo@2.0.0 is supported on Expo SDK 34? I’ve been nervous about upgrading because running expo install sentry-expo continues to install sentry-expo@1.13.0.

Even though I have no idea what goes in to the expo install command, I typically rely on that to help guarantee compatibility between versions of unimodules / wrapped APIs and Expo SDK versions.

Yeah it should work, but definitely let me know or open an issue if you run into any problems!

1 Like

FWIW, sentry-expo no longer works in the web after the update. It now produces this error in node_modules/sentry-expo/index.js:

Module parse failed: Unexpected token (25:12)
You may need an appropriate loader to handle this file type.
| class ExpoIntegration {
>   static id = "ExpoIntegration";
|   name =;

@apoyando I’m not sure if this will help you with that particular error, but in order to get my unit tests working again after upgrading sentry-expo, I had to modify my jest-config.js file’s transformIgnorePatterns to add @sentry/.* to be excluded from babel compilation.

I’m just guessing here, but perhaps the babel-preset-expo that is added to babel.config.js isn’t enough and something like @sentry/.* needs to be added there too as an exclusion?

@salus have you been able to successfully capture errors on web with sentry-expo@2.0.0? @apoyando sentry-expo doesn’t explicitly support web yet, were you able to capture errors on web in major version 1? Toying with the code and getting around the error you shared still results in ErrorUtils not being available (and that was used in the last version, as well)

@charliecruzan I bailed on Sentry in favor of Bugsnag (at least for the time being) because I couldn’t get Sentry to properly track releases and errors across both native and web. But with version 1, I was definitely tracking browser errors. I was able to get around the ErrorUtils reference error until I upgraded.

Okay, sorry you had trouble with making your previous workaround for v1 work for v2, but I’m looking in to making sentry-expo tri-platform so lmk what your workaround was

1 Like

I haven’t tried to support web yet on my project. Is there more to it than just adding “web” to the expo.platforms array in my app.json?

There are some instructions in the announcement:

To add web support to an Expo project , or a react-native init project ,

  • Ensure you’re using the latest version of babel-preset-expo
  • Install react-native-web, and react-dom.
  • Add the property “web” to the expo.platforms array in your app.json
  • Then run expo start with the latest version of the expo-cli after the bundler has started, you can press the w key to open your app in the browser.

Thanks for the instructions @wodin. @charliecruzan I went ahead and added Expo support to my project with sentry-expo 2.0 (Expo SDK 34.0.4) and it looks like I get the same error at @apoyando:

Trying to open the project in a web browser…
Starting Webpack on port 19006 in development mode.
[====================] 100% (20.4 seconds)

Failed to compile.
O:/work/redacted/node_modules/sentry-expo/index.js 25:12
Module parse failed: Unexpected token (25:12)
You may need an appropriate loader to handle this file type.
| class ExpoIntegration {

static id = “ExpoIntegration”;
| name =;

That error continues to occur when trying to start the project in the web browser, even after deleting my node_modules folder and package-lock.json file, running npm install, and then starting up again with expo start -c

Hello, a couple of days ago I upgraded to sentry-expo@2.0.0 using SDK 34 and the sources were updated to the new style required by sentry, for some reason it’s not getting the sourcemaps properly on sentry, it was working OK before with SDK 33 and sentry-expo@1.x.

Anyone else is having the same issue?


  "expo": {
    // ... existing configuration
    "hooks": {
      "postPublish": [
          "file": "sentry-expo/upload-sourcemaps",
          "config": {
            "organization": "skycop-paraguay-sa",
            "project": "skyapp",
            "authToken": "xxx"


import * as Sentry from 'sentry-expo';

const configure = dsn => {

const setUserContext = ctx => {
  ctx = ctx || {};
  Sentry.configureScope(scope => {

const captureMessage = (msg, opts) => {
  opts = opts || {};
  Sentry.withScope(scope => {
    if (opts.extra) {
    scope.setLevel(opts.level || 'error');

export default {

Issue on sentry:

The sources apparently on sentry:

hi outatime,

i have the same problem with the sources not showing up anymore since i updated from expo32 to expo35. i tried many thinks, but no success.

have you had any success with resolving this?

have you tried setting the releaseId according to the docs:
" In order to use the published release source maps with Issues in Sentry, you’ll have to set your Expo revisionId as the Sentry release identifier,"

the postPublish hook works for me too, and the source maps are uploaded correctly.
very strange…

Hi @pro-web,

I still have this problem, I did not test with SDK 35 or with the new expo-cli yet and the Sentry.setRelease(Constants.manifest.revisionId) line would seem to be new that was not required before and its available only in SDK 35 docs, i will try in my next OTA release, keep in touch please,

Thanks !!!

BTW, I do not think it is necessary to execute the line that appears in the docs of the sdk 35 (Sentry.setRelease(Constants.manifest.revisionId)), in the sentry-expo code the revisionId it is already passed to the init of the Sentry, take a look: