expo / sentry-expo

MIT License
202 stars 83 forks source link

"undefined is not a function" error with addTracingExtensions #345

Closed kevinhu closed 10 months ago

kevinhu commented 1 year ago

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

a-eid commented 1 year ago

facing the same error

Screenshot 2023-06-18 at 03 06 03

a-eid commented 1 year ago

this solution seem to work for me

"workspaces": {
    "packages": [
      "apps/*",
      "packages/*"
    ],
    "nohoist": [
      "**/@sentry/react-native"
    ]
  },
zackify commented 1 year ago
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

github-actions[bot] commented 11 months ago

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.

github-actions[bot] commented 10 months ago

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.

SleeplessByte commented 2 weeks ago

This still happens. Will try the workaround by https://github.com/expo/sentry-expo/issues/345#issuecomment-1620832670.

Cannot reproduce the error during development, but see sentry errors come in from production. Seems to happen on "first load".