expo / sentry-expo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"undefined is not a function" error with addTracingExtensions

kevinhu opened this issue · comments

Summary

I'm trying to use sentry-expo in iOS while also using expo-router. However, my app immediately crashes with an error stating that "undefined is not a function" while the trace points to an addTracingExtensions call.

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

Environment

expo-env-info 1.0.5 environment info:
System:
OS: macOS 13.4
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.14.1 - ~/.asdf/installs/nodejs/18.14.1/bin/node
Yarn: 1.22.19 - ~/.asdf/installs/nodejs/18.14.1/.npm/bin/yarn
npm: 9.3.1 - ~/.asdf/plugins/nodejs/shims/npm
Managers:
CocoaPods: 1.12.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
IDEs:
Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
npmPackages:
expo: ^48.0.19 => 48.0.19
react: ^18.2.0 => 18.2.0
react-dom: ^18.2.0 => 18.2.0
react-native: 0.71.8 => 0.71.8
react-native-web: ~0.18.10 => 0.18.12
npmGlobalPackages:
eas-cli: 3.13.3
expo-cli: 6.3.8
Expo Workflow: managed

Reproducible demo or steps to reproduce from a blank project

  • Install expo-router and sentry-expo
  • In any router file, use the following:
import * as Sentry from 'sentry-expo';
Sentry.init({
  dsn: "<DSN>",
  debug: true
});

facing the same error

Screenshot 2023-06-18 at 03 06 03

this solution seem to work for me

"workspaces": {
    "packages": [
      "apps/*",
      "packages/*"
    ],
    "nohoist": [
      "**/@sentry/react-native"
    ]
  },
import "expo-router/entry";
import * as Sentry from "sentry-expo";
import * as SentryNative from "@sentry/react-native";
Sentry.init({
  integrations: [new SentryNative.ReactNativeTracing()],
});

fixed this by importing from the actual @sentry/react-native package when using the expo library

This issue is stale because it has been open for 60 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.