core.addTracingExtensions() is not a function
MaxAst opened this issue · comments
Summary
I followed the installation instructions in the Using Sentry guide, but my app crashes right away with an uncaught error undefined is not a function
. The source of the error seems to be the core.addTracingExtension()
function from the @sentry/internal
package. I haven't found any other GH issues or Discord discussions citing this error.
Managed or bare workflow? If you have ios/
or android/
directories in your project, the answer is bare!
managed
What platform(s) does this occur on?
iOS
SDK Version (managed workflow only)
48.0.11
Environment
expo-env-info 1.0.5 environment info:
System:
OS: macOS 13.2
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
Watchman: 2023.02.13.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
IDEs:
Android Studio: 2022.2 AI-222.4459.24.2221.9971841
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
npmGlobalPackages:
eas-cli: 3.11.0
Expo Workflow: managed
Reproducible demo or steps to reproduce from a blank project
I installed sentry based on the instructions from the guide in the expo docs, so there aren't any specifics worth mentioning with respect to Sentry. Some details worth noting regarding my setup:
- I use a development build, not Expo Go
- I have a monorepo using turborepo and yarn
@MaxAst are you using expo router by chance? I started seeing this after customizing metro config to get builds working again after migrating to expo router. Ended up removing Sentry for now.
@erquhart nope, I'm not using expo router, just plain react navigation. My metro config looks like this, based on the working with monorepos docs :
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require("expo/metro-config");
const path = require("path");
// Find the workspace root, this can be replaced with `find-yarn-workspace-root`
const workspaceRoot = path.resolve(__dirname, "../..");
const projectRoot = __dirname;
const config = getDefaultConfig(projectRoot);
// 1. Watch all files within the monorepo
config.watchFolders = [workspaceRoot];
// 2. Let Metro know where to resolve packages, and in what order
config.resolver.nodeModulesPaths = [
path.resolve(projectRoot, "node_modules"),
path.resolve(workspaceRoot, "node_modules"),
];
// 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths`
config.resolver.disableHierarchicalLookup = true;
module.exports = config;
Fixed it by adding this to my monorepo's root package.json
"workspaces": {
"packages": [
"apps/*",
"packages/*"
],
"nohoist": [
"**/@sentry/react-native"
]
},
any ideas how to fix it in non-monorepo environment?
We use typescript and metro
@beshur errors like this are almost always related to sentry package version mismatches. Make sure that all sentry packages (e.g. @sentry/react-native
) that sentry-expo
depends on have the same version as yours