javascriptreact-nativeexposentry

PluginError: Failed to resolve plugin for module "@sentry/react-native/expo" relative to "root to project"


I recently upgraded my project from Expo SDK 51 to SDK 52. After the upgrade, I encountered an issue where @sentry/react-native/expo stopped working. If I remove @sentry/react-native/expo from my app config, all other plugins work as expected. However, with it included, Sentry fails to initialize properly.

I've tried a few troubleshooting steps but can't seem to find a solution. Has anyone else faced similar issues with Sentry on Expo SDK 52, or are there any known compatibility issues or workarounds?

app config(without '@sentry/react-native/expo' works):

plugins: [
    [
      '@sentry/react-native/expo',
    ],
    'expo-localization',
    [
      'expo-updates',
    ],
    [
      'expo-camera',
    ],
  ],

metro.config.js:

const { getSentryExpoConfig } = require('@sentry/react-native/metro');

const config = getSentryExpoConfig(__dirname);

module.exports = config;

tsconfig.json:

{
  "extends": "expo/tsconfig.base",
  "compilerOptions": {
    "strict": true
  },
  "types": ["react", "react-native"],
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    ".eslintrc.js", // Include ESLint configuration file
    "jest.config.js", // Include Jest configuration file
    "metro.config.js", // Include Metro configuration file
    "babel.config.js", // Include Babel configuration file
    "commitlint.config.js", // Include Commitlint configuration file
    "App.tsx" // Include Expo entry point
  ],
  "exclude": ["node_modules"]
}

package json:

"@sentry/react-native": "~6.1.0",

Solution

  • Fix is change '@sentry/react-native/expo' to '@sentry/react-native'