Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core.addTracingExtensions() is not a function #332

Closed
MaxAst opened this issue May 8, 2023 · 6 comments
Closed

core.addTracingExtensions() is not a function #332

MaxAst opened this issue May 8, 2023 · 6 comments

Comments

@MaxAst
Copy link

MaxAst commented May 8, 2023

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.

IMG_1117

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
@erquhart
Copy link

@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.

@MaxAst
Copy link
Author

MaxAst commented May 12, 2023

@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;

@MaxAst
Copy link
Author

MaxAst commented May 20, 2023

Fixed it by adding this to my monorepo's root package.json

  "workspaces": {
    "packages": [
      "apps/*",
      "packages/*"
    ],
    "nohoist": [
      "**/@sentry/react-native"
    ]
  },

@MaxAst MaxAst closed this as completed May 20, 2023
@beshur
Copy link

beshur commented Sep 25, 2023

any ideas how to fix it in non-monorepo environment?
We use typescript and metro

@MaxAst
Copy link
Author

MaxAst commented Sep 25, 2023

@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

@beshur
Copy link

beshur commented Sep 26, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants