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

getFullURL throwing exceptions on React Native #4436

Open
AdamTyler opened this issue Jan 10, 2025 · 1 comment
Open

getFullURL throwing exceptions on React Native #4436

AdamTyler opened this issue Jan 10, 2025 · 1 comment

Comments

@AdamTyler
Copy link

AdamTyler commented Jan 10, 2025

constant exceptions (for every api call, even localhost) in the getFullURL function since helpers.WINDOW.location is undefined.

What React Native libraries do you use?

Expo (mobile only), Expo Router, Expo Application Services (EAS)

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

6.5.0

How does your development environment look like?

System:
  OS: macOS 14.7.2
  CPU: (12) arm64 Apple M2 Pro
  Memory: 91.20 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.18.1
    path: ~/.nvm/versions/node/v20.18.1/bin/node
  Yarn:
    version: 4.5.1
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.8.2
    path: ~/.nvm/versions/node/v20.18.1/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.1
      - iOS 18.1
      - macOS 15.1
      - tvOS 18.1
      - visionOS 2.1
      - watchOS 11.1
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10811636
  Xcode:
    version: 16.1/16B40
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 3.3.0
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.1.3
    wanted: ^15.1.3
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.5
    wanted: 0.76.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Sentry.init()

Sentry.init({
  debug: false,
  dsn: config.sentryDsn,
  enableAppStartTracking: true,
  enableNativeFramesTracking: true,
  enableStallTracking: true,
  enableUserInteractionTracing: true,
  environment: config.sentryEnv,
  integrations: [
    navigationIntegration,
  ],

const navigationIntegration = Sentry.reactNavigationIntegration({
  enableTimeToInitialDisplay:
    Constants.executionEnvironment === ExecutionEnvironment.StoreClient,
});

Steps to Reproduce

Use latest expo to create RN app
Add Sentry 6.5.0
Start up either iOS or Android app locally

Expected Result

App to behave normally and only send exceptions if they come up from the code

Actual Result

constant exceptions in the getFullURL function since helpers.WINDOW.location is undefined.

Image

Assuming its because this is executing in the browsers package in sentry and in RN there is no window.location

@krystofwoldrich
Copy link
Member

Hi @AdamTyler,
thank you for the message, you are right window.location does not exist in React Native.

We should check this field before accessing it.

Just to confirm, this causes issues only when debugging the application with Pause on caught exceptions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: Needs Discussion
Development

No branches or pull requests

2 participants