Skip to content

App start duration is over a minute long, not adding app start span #4438

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

Closed
asnaseer opened this issue Jan 13, 2025 · 28 comments
Closed

App start duration is over a minute long, not adding app start span #4438

asnaseer opened this issue Jan 13, 2025 · 28 comments

Comments

@asnaseer
Copy link

What React Native libraries do you use?

Expo (mobile only), Expo Application Services (EAS), React Navigation

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

5.36.0

How does your development environment look like?

info Fetching system and libraries information...
System:
OS: macOS 13.7.2
CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
Memory: 1.17 GB / 32.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.20.2
path: ~/.nvm/versions/node/v18.20.2/bin/node
Yarn:
version: 1.22.10
path: /usr/local/bin/yarn
npm:
version: 10.5.0
path: ~/.nvm/versions/node/v18.20.2/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.15.2
path: /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.2
- iOS 17.2
- macOS 14.2
- tvOS 17.2
- visionOS 1.0
- watchOS 10.2
Android SDK:
API Levels:
- "31"
- "34"
Build Tools:
- 31.0.0
- 33.0.1
- 34.0.0
System Images:
- android-31 | Intel x86_64 Atom
Android NDK: Not Found
IDEs:
Android Studio: 2022.3 AI-223.8836.35.2231.10811636
Xcode:
version: 15.2/15C500b
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.11
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 15.1.3
wanted: latest
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.74.5
wanted: 0.74.5
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false

Sentry.init()

import * as Sentry from "@sentry/react-native";

export const sentryReactNavigationInstrumentation =
  new Sentry.ReactNavigationInstrumentation({
    enableTimeToInitialDisplay: true,
  });

const reactNativeTracingIntegration = new Sentry.ReactNativeTracing({
  routingInstrumentation: sentryReactNavigationInstrumentation,
});

export const initSentry = (): void => {
  Sentry.init({
    dsn: "https://...",
    enableAutoSessionTracking: true,
    enableAutoPerformanceTracing: true,
    enableUserInteractionTracing: true,
    environment: __DEV__ ? "development" : "production",
    debug: __DEV__,
    enableNative: true,
    integrations: (integrations) => {
      return [
        ...integrations.filter(
          (integration) => integration.name !== "ReactNativeTracing"
        ),
        reactNativeTracingIntegration,
        Sentry.hermesProfilingIntegration({
          platformProfilers: false,
        }),
      ];
    },
    tracePropagationTargets: [API_URL],
    tracesSampleRate: __DEV__ ? 1 : 0.1,
    profilesSampleRate: __DEV__ ? 1 : 0.1,
    maxValueLength: 2048,
  });
};

In a separate file:

    ...
    return <NavigationContainer
      ...
      onReady={() => {
        sentryReactNavigationInstrumentation.registerNavigationContainer(navigationRef);
      }}
    >...</NavigationContainer>;
    ...

Steps to Reproduce

  1. yarn start
  2. then scan QR code on Google Pixel 4a mobile
  3. I then see this logging from Sentry in the console:
 WARN  Sentry Logger [warn]: You appear to have multiple versions of the "promise" package installed. This may cause unexpected behavior like undefined `Promise.allSettled`. Please install the `promise` package manually using the exact version as the React Native package. See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.
 LOG  Sentry Logger [log]: Unhandled promise rejections will be caught by Sentry.
 LOG  Sentry Logger [log]: Integration installed: ReactNativeErrorHandlers
 LOG  Sentry Logger [log]: Integration installed: NativeLinkedErrors
 LOG  Sentry Logger [log]: Integration installed: InboundFilters
 LOG  Sentry Logger [log]: Integration installed: FunctionToString
 LOG  Sentry Logger [log]: Integration installed: Breadcrumbs
 LOG  Sentry Logger [log]: Integration installed: Dedupe
 LOG  Sentry Logger [log]: Integration installed: HttpContext
 LOG  Sentry Logger [log]: Integration installed: Release
 LOG  Sentry Logger [log]: Integration installed: EventOrigin
 LOG  Sentry Logger [log]: Integration installed: SdkInfo
 LOG  Sentry Logger [log]: Integration installed: ReactNativeInfo
 LOG  Sentry Logger [log]: Integration installed: DebugSymbolicator
 LOG  Sentry Logger [log]: Integration installed: RewriteFrames
 LOG  Sentry Logger [log]: Integration installed: DeviceContext
 LOG  Sentry Logger [log]: Integration installed: ModulesLoader
 LOG  Sentry Logger [log]: Integration installed: HermesProfiling
 LOG  Sentry Logger [log]: [ReactNativeTracing] Native frames instrumentation initialized.
 LOG  Sentry Logger [log]: Setting idle transaction on scope. Span ID: 9752cbdc0639aad7
 LOG  Sentry Logger [log]: [Tracing] starting navigation transaction - Route Change
 LOG  Sentry Logger [log]: Starting heartbeat
 LOG  Sentry Logger [log]: pinging Heartbeat -> current counter: 0
 LOG  Sentry Logger [log]: [NATIVE] Start Profiling
 LOG  Sentry Logger [log]: [Profiling] started profiling:  69506c4e73ae4af48a90ec17275c7f01
 WARN  Sentry Logger [warn]: [ReactNativeTracing] onTransactionStart called with delay (larger than margin of error) for transaction Route Change (9752cbdc0639aad7). Not fetching native frames or tracking stalls.
 LOG  Sentry Logger [log]: [ReactNativeTracing] Starting navigation transaction "Route Change" on scope
 LOG  Sentry Logger [log]: [Tracing] pushActivity: 87e327e289c1f318
 LOG  Sentry Logger [log]: [Tracing] new activities count 1
 LOG  Sentry Logger [log]: [Tracing] Starting 'navigation.processing' span on transaction 'Navigation processing' (9752cbdc0639aad7).
 LOG  Sentry Logger [log]: Integration installed: ReactNativeTracing
 LOG  Sentry Logger [log]: Integration installed: react-navigation-v5
 LOG  Sentry Logger [log]: Integration installed: ReactNativeUserInteractionTracing
 LOG  Sentry Logger [log]: [Tracing] pushActivity: b45e0b8e4ab358d9
 LOG  Sentry Logger [log]: [Tracing] new activities count 2
 LOG  Sentry Logger [log]: [Tracing] Starting 'ui.react.mount' span on transaction '<Root>' (9752cbdc0639aad7).
 LOG  Sentry Logger [log]: [Tracing] popActivity b45e0b8e4ab358d9
 LOG  Sentry Logger [log]: [Tracing] new activities count 1
 LOG  Sentry Logger [log]: Integration installed: ReactNativeProfiler
 LOG  Sentry Logger [log]: Integration installed: TouchEventBoundary
 LOG  Sentry Logger [log]: [Tracing] pushActivity: 9661e89d85c50e9d
 LOG  Sentry Logger [log]: [Tracing] new activities count 2
 LOG  Sentry Logger [log]: [Tracing] Starting 'http.client' span on transaction 'GET https://cdn-settings.segment.com/v1/projects/__DEV__/settings' (9752cbdc0639aad7).
 LOG  Sentry Logger [log]: [Tracing] pushActivity: b1f7a91299d4814b
 LOG  Sentry Logger [log]: [Tracing] new activities count 3
 LOG  Sentry Logger [log]: [Tracing] Starting 'http.client' span on transaction 'GET https://cdn.growthbook.io/api/features/sdk-sdxocdjfHOEz1bms' (9752cbdc0639aad7).
 LOG  Sentry Logger [log]: [Tracing] pushActivity: a59ae85bd9f584e2
 LOG  Sentry Logger [log]: [Tracing] new activities count 4
 LOG  Sentry Logger [log]: [Tracing] Starting 'http.client' span on transaction 'POST http://...:8081/symbolicate' (9752cbdc0639aad7).
 LOG  Sentry Logger [log]: [Tracing] pushActivity: 935a443ba55894af
 LOG  Sentry Logger [log]: [Tracing] new activities count 5
 LOG  Sentry Logger [log]: [Tracing] Starting 'http.client' span on transaction 'POST https://identitytoolkit.googleapis.com/v1/accounts:lookup?key=...' (9752cbdc0639aad7).
 LOG  Sentry Logger [log]: [Tracing] popActivity a59ae85bd9f584e2
 LOG  Sentry Logger [log]: [Tracing] new activities count 4
 LOG  Sentry Logger [log]: [Tracing] popActivity b1f7a91299d4814b
 LOG  Sentry Logger [log]: [Tracing] new activities count 3
 LOG  Sentry Logger [log]: [Tracing] finishing IdleTransaction 2025-01-13T09:25:48.300Z navigation
 DEBUG  Sentry Logger [debug]: Removing AppState listener for navigation transaction.
 LOG  Sentry Logger [log]: [StallTracking] Stall measurements were not added to transaction due to exceeding the max count.
 WARN  Sentry Logger [warn]: [ReactNativeTracing] App start duration is over a minute long, not adding app start span.
 LOG  Sentry Logger [log]: [Tracing] cancelling span since transaction ended early {
  "data": {
    "sentry.origin": "manual",
    "sentry.op": "navigation.processing"
  },
  "description": "Navigation processing",
  "op": "navigation.processing",
  "parent_span_id": "9752cbdc0639aad7",
  "span_id": "87e327e289c1f318",
  "start_timestamp": 1736760347.2149503,
  "status": "cancelled",
  "timestamp": 1736760348.3000896,
  "trace_id": "9994af8fd194415d852d39c398aa1302",
  "origin": "manual"
}
 LOG  Sentry Logger [log]: [Tracing] cancelling span since transaction ended early {
  "data": {
    "sentry.origin": "auto.http.browser",
    "sentry.op": "http.client",
    "type": "xhr",
    "http.method": "GET",
    "url": "https://cdn-settings.segment.com/v1/projects/__DEV__/settings"
  },
  "description": "GET https://cdn-settings.segment.com/v1/projects/__DEV__/settings",
  "op": "http.client",
  "parent_span_id": "9752cbdc0639aad7",
  "span_id": "9661e89d85c50e9d",
  "start_timestamp": 1736760347.8097413,
  "status": "cancelled",
  "timestamp": 1736760348.3000896,
  "trace_id": "9994af8fd194415d852d39c398aa1302",
  "origin": "auto.http.browser"
}
 LOG  Sentry Logger [log]: [Tracing] cancelling span since transaction ended early {
  "data": {
    "sentry.origin": "auto.http.browser",
    "sentry.op": "http.client",
    "type": "xhr",
    "http.method": "POST",
    "url": "https://identitytoolkit.googleapis.com/v1/accounts:lookup?key=..."
  },
  "description": "POST https://identitytoolkit.googleapis.com/v1/accounts:lookup?key=...",
  "op": "http.client",
  "parent_span_id": "9752cbdc0639aad7",
  "span_id": "935a443ba55894af",
  "start_timestamp": 1736760348.1031985,
  "status": "cancelled",
  "timestamp": 1736760348.3000896,
  "trace_id": "9994af8fd194415d852d39c398aa1302",
  "origin": "auto.http.browser"
}
 LOG  Sentry Logger [log]: [Tracing] flushing IdleTransaction
 WARN  Sentry Logger [warn]: [NATIVE] Stop Profiling Failed: No Android Profile
 LOG  Sentry Logger [log]: [Profiling] finished profiling:  69506c4e73ae4af48a90ec17275c7f01
 LOG  Sentry Logger [log]: [Tracing] Discarding transaction because its trace was not chosen to be sampled.
 LOG  Sentry Logger [log]: Recording outcome: "sample_rate:transaction"
 LOG  Sentry Logger [log]: [ReactNavigationInstrumentation] Navigation container registered, but integration has not been setup yet.
 LOG  Sentry Logger [log]: [NativeFrames] Native frames timed out for ui.load transaction Route Change. Not adding native frames measurements.

Expected Result

I did not expect to see these in the log above:

 ...
 LOG  Sentry Logger [log]: [StallTracking] Stall measurements were not added to transaction due to exceeding the max count.
 WARN  Sentry Logger [warn]: [ReactNativeTracing] App start duration is over a minute long, not adding app start span.
 ...
 WARN  Sentry Logger [warn]: [NATIVE] Stop Profiling Failed: No Android Profile
 ...
 LOG  Sentry Logger [log]: [ReactNavigationInstrumentation] Navigation container registered, but integration has not been setup yet.
 LOG  Sentry Logger [log]: [NativeFrames] Native frames timed out for ui.load transaction Route Change. Not adding native frames measurements.

In the Sentry web page, I am clicking on Mobile in the left-hand-panel and expecting to see results in the tabs: Overview, App Starts, Screen Loads, Screen Rendering, Network Requests.

However, I only see data in the Overview and Network Requests tabs.

Could you please advise on how to fix this?

Actual Result

In the Sentry web page, after I click on Mobile in the left-hand-panel, I only see data in the Overview and Network Requests tabs.

@buenaflor
Copy link

cc @krystofwoldrich

@krystofwoldrich
Copy link
Member

Hi @asnaseer,
thank you for the message.

I see two main issues in the logs.


Based on the log below. When do you call initSentry? Sentry should be called as early as possible, the best is right when JS start executing.

Navigation container registered, but integration has not been setup yet.

Based on the log below. If you can upgrade to the RN SDK v6 this limitation was removed for dev builds as part of the start time is bundling of the JS which can take more than a minute. You can also try this in a Release version, which should start under a minute. Note that the start time is measured till the firs screen from the navigation container is rendered.

App start duration is over a minute long, not adding app start span.

@krystofwoldrich krystofwoldrich moved this from Needs Discussion to Needs More Information in Mobile SDKs Jan 15, 2025
@getsantry getsantry bot moved this to Waiting for: Community in GitHub Issues with 👀 3 Jan 15, 2025
@asnaseer
Copy link
Author

Based on the log below. When do you call initSentry? Sentry should be called as early as possible, the best is right when JS start executing.

I call initSentry from index.js which has this content:

import "react-native-gesture-handler";

import * as Sentry from "@sentry/react-native";
import { registerRootComponent } from "expo";
import { initSentry } from "src/modules/initSentry";

import App from "./App";

console.log(">>> initSentry...");
initSentry();
registerRootComponent(Sentry.wrap(App));

If I add logging to my NavigationContainer as follows:

    ...
    return <NavigationContainer
      ...
      onReady={() => {
        console.log(
          ">>> NavigationContainer - registering sentryReactNavigationInstrumentation..."
        );
        sentryReactNavigationInstrumentation.registerNavigationContainer(navigationRef);
      }}
    >...</NavigationContainer>;
    ...

then I see my logs appear as:

...
 LOG  >>> initSentry...
 WARN  Sentry Logger [warn]: You appear to have multiple versions of the "promise" package installed. This may cause unexpected behavior like undefined `Promise.allSettled`. Please install the `promise` package manually using the exact version as the React Native package. See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.
 LOG  Sentry Logger [log]: Unhandled promise rejections will be caught by Sentry.
 LOG  Sentry Logger [log]: Integration installed: ReactNativeErrorHandlers
...
 LOG  Sentry Logger [log]: [NativeFrames] Native frames timed out for navigation transaction Route Change. Not adding native frames measurements.
 LOG  >>> NavigationContainer - registering sentryReactNavigationInstrumentation...
 LOG  Sentry Logger [log]: [ReactNavigationInstrumentation] Navigation container registered, but integration has not been setup yet.
...

Based on the log below. If you can upgrade to the RN SDK v6 this limitation was removed for dev builds as part of the start time is bundling of the JS which can take more than a minute.

Which specific library do you mean here? We use these libraries in package.json (we use the Expo 51 framework):

  "dependencies": {
    "-": "^0.0.1",
    "@apollo/client": "^3.3.7",
    "@babel/preset-typescript": "^7.15.0",
    "@birda/audiotools": "ssh://[email protected]/ChirpBirding/audiotools#v1.0.1",
    "@config-plugins/react-native-branch": "^8.0.0",
    "@dev-plugins/apollo-client": "^0.0.6",
    "@dev-plugins/react-navigation": "^0.0.6",
    "@expo-google-fonts/rubik": "^0.1.0",
    "@expo/metro-config": "~0.18.11",
    "@expo/react-native-action-sheet": "^3.9.0",
    "@expo/vector-icons": "^14.0.3",
    "@fortawesome/fontawesome-svg-core": "^6.1.1",
    "@fortawesome/free-brands-svg-icons": "^6.4.2",
    "@fortawesome/free-regular-svg-icons": "^6.0.0",
    "@fortawesome/free-solid-svg-icons": "^6.0.0",
    "@fortawesome/pro-light-svg-icons": "^6.2.0",
    "@fortawesome/pro-regular-svg-icons": "^6.0.0",
    "@fortawesome/pro-solid-svg-icons": "^6.0.0",
    "@fortawesome/react-native-fontawesome": "^0.3.2",
    "@gorhom/bottom-sheet": "^4.6.3",
    "@growthbook/growthbook-react": "^1.2.0",
    "@hookform/resolvers": "^1.3.4",
    "@infinitered/react-native-mlkit-object-detection": "^2.0.1",
    "@intercom/intercom-react-native": "^6.8.1",
    "@mapbox/geo-viewport": "^0.5.0",
    "@ptomasroos/react-native-multi-slider": "git+https://github.com/ChirpBirding/react-native-multi-slider.git#f5ef5dc6b53c106737f116d586a1c8deb298fbea",
    "@react-native-async-storage/async-storage": "1.23.1",
    "@react-native-community/blur": "^4.4.0",
    "@react-native-community/datetimepicker": "8.0.1",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/netinfo": "11.3.1",
    "@react-native-firebase/analytics": "^20.3.0",
    "@react-native-firebase/app": "^20.3.0",
    "@react-native-google-signin/google-signin": "^10.0.1",
    "@react-native-voice/voice": "^3.2.4",
    "@react-navigation/bottom-tabs": "^6.5.20",
    "@react-navigation/drawer": "^6.6.15",
    "@react-navigation/material-top-tabs": "^6.6.13",
    "@react-navigation/native": "^6.1.17",
    "@react-navigation/stack": "^6.3.29",
    "@rnmapbox/maps": "^10.1.23",
    "@segment/analytics-react-native": "^2.19.1",
    "@segment/sovran-react-native": "^1.1.1",
    "@sentry/react-native": "^5.36.0",
    "@shopify/flash-list": "1.6.4",
    "@testing-library/react-native": "^12.1.0",
    "@turf/bbox": "^6.5.0",
    "@turf/center": "^6.5.0",
    "@turf/helpers": "~6.5.0",
    "@types/i18n-js": "^3.8.0",
    "@types/invariant": "^2.2.37",
    "@types/node-fetch": "^2.5.8",
    "@types/numbro": "^1.9.3",
    "@types/react-native-svg-charts": "^5.0.7",
    "@types/uuid": "^8.3.1",
    "apollo-link-queue": "^3.1.0",
    "apollo-link-sentry": "^3.2.1",
    "apollo3-cache-persist": "^0.14.0",
    "autoprefixer": "^10.2.4",
    "babel-plugin-module-resolver": "^5.0.0",
    "buffer": "^6.0.3",
    "camelcase-keys": "^6.2.2",
    "color": "^3.1.3",
    "d3-shape": "^2.0.0",
    "date-fns": "^2.21.1",
    "diff": "^5.0.0",
    "dotenv": "^8.2.0",
    "eventemitter3": "^4.0.7",
    "expo": "~51.0.39",
    "expo-apple-authentication": "~6.4.2",
    "expo-application": "~5.9.1",
    "expo-asset": "~10.0.10",
    "expo-av": "~14.0.7",
    "expo-build-properties": "~0.12.5",
    "expo-camera": "~15.0.16",
    "expo-clipboard": "~6.0.3",
    "expo-constants": "~16.0.2",
    "expo-contacts": "~13.0.5",
    "expo-crypto": "~13.0.2",
    "expo-dev-client": "~4.0.29",
    "expo-device": "~6.0.2",
    "expo-file-system": "~17.0.1",
    "expo-font": "~12.0.10",
    "expo-gl": "~14.0.2",
    "expo-haptics": "~13.0.1",
    "expo-image-manipulator": "~12.0.5",
    "expo-image-picker": "~15.0.7",
    "expo-intent-launcher": "~11.0.1",
    "expo-linear-gradient": "~13.0.2",
    "expo-linking": "~6.3.1",
    "expo-localization": "~15.0.3",
    "expo-location": "~17.0.1",
    "expo-mail-composer": "~13.0.1",
    "expo-media-library": "~16.0.5",
    "expo-notifications": "~0.28.19",
    "expo-random": "~14.0.1",
    "expo-sms": "~12.0.1",
    "expo-splash-screen": "~0.27.7",
    "expo-sqlite": "~14.0.6",
    "expo-status-bar": "~1.12.1",
    "expo-store-review": "~7.0.2",
    "expo-task-manager": "~11.8.2",
    "expo-tracking-transparency": "~4.0.2",
    "expo-updates": "~0.25.27",
    "expo-web-browser": "~13.0.3",
    "fast-xml-parser": "^3.18.0",
    "fetch-retry": "^5.0.6",
    "firebase": "10.12.2",
    "fuse.js": "^6.6.2",
    "geojson-extent": "^0.3.2",
    "graphql": "^15.4.0",
    "h3-js": "3.7.2",
    "highlight-words-core": "^1.2.2",
    "i18n-js": "^3.8.0",
    "jest": "^29.5.0",
    "jest-expo": "~51.0.4",
    "jsonwebtoken": "^8.5.1",
    "jwt-decode": "^3.1.2",
    "lamejs": "https://github.com/zhuker/lamejs",
    "lodash": "^4.17.20",
    "lottie-react-native": "6.7.0",
    "numbro": "^2.3.6",
    "parse-ms": "^2",
    "patch-package": "^6.4.7",
    "path-to-regexp": "^6.2.0",
    "pluralize": "ChirpBirding/pluralize",
    "postcss": "^8.2.4",
    "postinstall-postinstall": "^2.1.0",
    "promise.allsettled": "^1.0.5",
    "query-string": "^6.13.8",
    "react": "18.2.0",
    "react-content-loader": "^6.2.0",
    "react-dom": "18.2.0",
    "react-hook-form": "^6.15.1",
    "react-native": "0.74.5",
    "react-native-animatable": "^1.3.3",
    "react-native-animated-spinkit": "^1.5.1",
    "react-native-appstate-hook": "^1.0.6",
    "react-native-branch": "^6.2.1",
    "react-native-calendars": "1.1294.0",
    "react-native-canvas": "^0.1.40",
    "react-native-circular-progress": "^1.3.7",
    "react-native-collapsible": "^1.6.0",
    "react-native-confetti-cannon": "^1.5.1",
    "react-native-drag-sort": "^2.4.4",
    "react-native-fast-image": "^8.5.11",
    "react-native-fast-tflite": "1.3.0",
    "react-native-fbsdk-next": "^12.2.0",
    "react-native-fs": "^2.20.0",
    "react-native-gesture-handler": "~2.16.1",
    "react-native-get-random-values": "~1.11.0",
    "react-native-image-colors": "^1.5.2",
    "react-native-image-crop-picker": "^0.41.2",
    "react-native-image-picker": "^7.1.2",
    "react-native-image-viewing": "git+https://github.com/ChirpBirding/react-native-image-viewing.git#906090627dcd029164ed26fc6108abe640bf2e75",
    "react-native-keyboard-controller": "^1.15.2",
    "react-native-live-audio-stream": "^1.1.1",
    "react-native-localize": "^3.0.6",
    "react-native-markdown-display": "^7.0.0-alpha.2",
    "react-native-mime-types": "^2.3.0",
    "react-native-pager-view": "v7.0.0-rc.0",
    "react-native-purchases": "^7.5.0",
    "react-native-reanimated": "~3.12.0",
    "react-native-safe-area-context": "4.10.5",
    "react-native-screens": "3.31.1",
    "react-native-share": "^8.2.2",
    "react-native-sse": "^1.2.1",
    "react-native-status-bar-height": "^2.6.0",
    "react-native-svg": "15.2.0",
    "react-native-svg-charts": "^5.4.0",
    "react-native-tab-view": "^3.5.2",
    "react-native-url-polyfill": "^1.3.0",
    "react-native-view-shot": "3.8.0",
    "react-native-vision-camera": "4.5.1",
    "react-native-web": "~0.19.10",
    "react-native-webview": "13.8.6",
    "react-native-zip-archive": "^6.0.5",
    "react-native-zoom-toolkit": "^3.1.0",
    "react-use": "^17.2.4",
    "tailwind-rn": "^3.0.0",
    "tailwindcss": "^2.0.2",
    "url-join": "^5.0.0",
    "use-debounce": "^7.0.0",
    "use-interval": "^1.3.0",
    "uuid": "^8.3.2",
    "victory-native": "^35.3.1",
    "yup": "^0.32.8",
    "zod": "^3.23.8",
    "zod-validation-error": "^3.4.0"
  },
  "devDependencies": {
    "@apollo/rover": "^0.23.0",
    "@babel/core": "^7.24.0",
    "@babel/plugin-syntax-async-generators": "^7.8.4",
    "@config-plugins/detox": "^7.0.0",
    "@expo/config": "~9.0.0",
    "@graphql-codegen/add": "^5.0.2",
    "@graphql-codegen/cli": "^5.0.2",
    "@graphql-codegen/typescript": "^4.0.7",
    "@phenomnomnominal/tsquery": "^6.1.3",
    "@react-native-community/cli": "latest",
    "@sinonjs/fake-timers": "^7.0.5",
    "@types/color": "^3.0.1",
    "@types/d3-shape": "^2.0.0",
    "@types/diff": "^5.0.2",
    "@types/highlight-words-core": "^1.2.1",
    "@types/jest": "^29.5.11",
    "@types/jsonwebtoken": "^8.5.5",
    "@types/mapbox__geo-viewport": "^0.5.3",
    "@types/pluralize": "^0.0.29",
    "@types/promise.allsettled": "^1.0.3",
    "@types/react-native-calendars": "^1.505.0",
    "@types/react-test-renderer": "^18.0.7",
    "@types/traverse": "^0.6.32",
    "@types/websql": "^0.0.27",
    "@typescript-eslint/eslint-plugin": "6.5.0",
    "@typescript-eslint/parser": "6.5.0",
    "deep-diff": "^1.0.2",
    "detox": "20.17.0",
    "enzyme": "^3.11.0",
    "eslint": "^7.18.0",
    "eslint-config-prettier": "^7.2.0",
    "eslint-plugin-i18next": "^5.0.0",
    "eslint-plugin-jest": "^24.1.3",
    "eslint-plugin-react": "^7.31.0",
    "eslint-plugin-react-hooks": "^4.2.0",
    "eslint-plugin-react-native": "^4.0.0",
    "eslint-plugin-simple-import-sort": "^7.0.0",
    "husky": ">=4",
    "jest-extended": "^4.0.2",
    "lint-staged": ">=10",
    "mkdirp": "^3.0.1",
    "mockdate": "3.0.5",
    "node-fetch": "^2.6.1",
    "prettier": "^2.8",
    "react-devtools": "^5.3.2",
    "react-test-renderer": "18.2.0",
    "standard-version": "^7.1.0",
    "standard-version-expo": "^1.0.3",
    "ts-jest": "^29.1.3",
    "typescript": "^4.9.5",
    "websql": "^2.0.3"
  },

@getsantry getsantry bot moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 3 Jan 16, 2025
@asnaseer
Copy link
Author

@krystofwoldrich If you meant upgrade to v6 of the @sentry/react-native, then I can try that but I see that Expo 51 says that it is compatible with v5.24.0. I hope that will not cause any unexpected issues.

@asnaseer
Copy link
Author

After upgrading @sentry/react-native to 6.5.0, I modified by initialisation as follows:

import * as Sentry from "@sentry/react-native";

export const sentryReactNavigationIntegration =
  Sentry.reactNavigationIntegration({
    enableTimeToInitialDisplay: true,
  });

export const initSentry = (): void => {
  Sentry.init({
    dsn: "https://...",
    enableAppStartTracking: true,
    enableNativeFramesTracking: true,
    enableStallTracking: true,
    enableUserInteractionTracing: true,
    enableAutoSessionTracking: true,
    enableAutoPerformanceTracing: true,
    environment: __DEV__ ? "development" : "production",
    debug: __DEV__,
    enableNative: true,
    integrations: (integrations) => {
      return [
        ...integrations,
        Sentry.hermesProfilingIntegration({ platformProfilers: false }),
      ];
    },
    tracesSampleRate: __DEV__ ? 1 : 0.1,
    profilesSampleRate: __DEV__ ? 1 : 0.1,
    maxValueLength: 2048,
  });

  // add the last logged in user so Sentry logs contain a user id, even
  // when the user isn't logged in.
  (async () => {
    try {
      const lastLoggedInUserId = await getLastLoggedInUserId();
      Sentry.setContext("Last Logged in User", {
        lastLoggedInUserId: lastLoggedInUserId,
      });
      // tags are searchable in sentry UI.
      Sentry.getCurrentScope().setTag("lastLoggedInUserId", lastLoggedInUserId);
    } catch (error) {
      logError(error, "couldn't set last logged in user");
    }
  })();
};

I then ran the app locally via yarn start and I saw these logs after I had scanned the QR code:

...
 LOG  >>> initSentry...
 WARN  Sentry Logger [warn]: You appear to have multiple versions of the "promise" package installed. This may cause unexpected behavior like undefined `Promise.allSettled`. Please install the `promise` package manually using the exact version as the React Native package. See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.
 LOG  Sentry Logger [log]: Unhandled promise rejections will be caught by Sentry.
 LOG  Sentry Logger [log]: Integration installed: ReactNativeErrorHandlers
 LOG  Sentry Logger [log]: Integration installed: NativeLinkedErrors
 LOG  Sentry Logger [log]: Integration installed: InboundFilters
 LOG  Sentry Logger [log]: Integration installed: FunctionToString
 LOG  Sentry Logger [log]: Integration installed: Breadcrumbs
 LOG  Sentry Logger [log]: Integration installed: Dedupe
 LOG  Sentry Logger [log]: Integration installed: HttpContext
 LOG  Sentry Logger [log]: Integration installed: Release
 LOG  Sentry Logger [log]: Integration installed: EventOrigin
 LOG  Sentry Logger [log]: Integration installed: SdkInfo
 LOG  Sentry Logger [log]: Integration installed: ReactNativeInfo
 LOG  Sentry Logger [log]: Integration installed: RewriteFrames
 LOG  Sentry Logger [log]: Integration installed: DeviceContext
 LOG  Sentry Logger [log]: Integration installed: ModulesLoader
 LOG  Sentry Logger [log]: Integration installed: HermesProfiling
 LOG  Sentry Logger [log]: Integration installed: AppStart
 LOG  Sentry Logger [log]: Integration installed: NativeFrames
 LOG  Sentry Logger [log]: Integration installed: StallTracking
 LOG  Sentry Logger [log]: Integration installed: UserInteraction
 LOG  Sentry Logger [log]: Integration installed: ReactNativeTracing
 LOG  Sentry Logger [log]: Integration installed: DebugSymbolicator
 LOG  Sentry Logger [log]: Integration installed: ReactNativeProfiler
 DEBUG  Sentry Logger [debug]: [AppStart] App start tracking is enabled. App start will be added to the first transaction as a child span.
 LOG  Sentry Logger [log]: Integration installed: TouchEventBoundary
 ERROR  Failed to process unpublished subscription events [TypeError: 0, browser_1.configureScope is not a function (it is undefined)]
 WARN  Sentry Logger [warn]: Unable to symbolicate stack trace: Network request failed
 WARN  Sentry Logger [warn]: Unable to symbolicate stack trace: Network request failed
 LOG  Sentry Logger [log]: ReactNavigation Navigation container registered, but integration has not been setup yet.
 ERROR  TypeError: 0, browser_1.configureScope is not a function (it is undefined), js engine: hermes
 ERROR  TypeError: 0, browser_1.configureScope is not a function (it is undefined), js engine: hermes
 ERROR  TypeError: 0, browser_1.configureScope is not a function (it is undefined), js engine: hermes
 ERROR  TypeError: 0, browser_1.configureScope is not a function (it is undefined), js engine: hermes
 LOG  undefined    {}
 LOG  undefined    {}
 WARN  Sentry Logger [warn]: Unable to symbolicate stack trace: Network request failed
 WARN  Sentry Logger [warn]: Unable to symbolicate stack trace: Network request failed
 WARN  Sentry Logger [warn]: Unable to symbolicate stack trace: Network request failed
 WARN  Sentry Logger [warn]: Unable to symbolicate stack trace: Network request failed

which seems to have several error logs of the form:

ERROR  TypeError: 0, browser_1.configureScope is not a function (it is undefined), js engine: hermes

The app does not seem to work properly after this upgrade and I still do not see anything under the App Starts tab of Mobile in the Sentry web page.

@krystofwoldrich
Copy link
Member

Hi @asnaseer,
thank you for the details.


If you meant upgrade to v6 of the @sentry/react-native, then I can try that but I see that Expo 51 says that it is compatible with v5.24.0. I hope that will not cause any unexpected issues.

Yes, that's what I meant.


 ERROR  TypeError: 0, browser_1.configureScope is not a function (it is undefined), js engine: hermes

The configureScope is not a function caused by mismatch in the installed dependencies of @sentry/react-native which expect the following.

https://github.com/getsentry/sentry-react-native/blob/main/packages/core/package.json#L69-L74

But was bundled with @sentry/* of older version, likely v7. Do you use any of the @sentry/* packages directly?

@asnaseer
Copy link
Author

asnaseer commented Jan 21, 2025

@krystofwoldrich

Do you use any of the @sentry/* packages directly?

No we do not.

After running yarn add @sentry/[email protected], I ran these commands to check the versions of the @sentry/* packages from your link:

`yarn why @sentry/browser`
yarn why v1.22.10
[1/4] 🤔  Why do we have the module "@sentry/browser"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@sentry/[email protected]"
info Reasons this module exists
   - "@sentry#react-native" depends on it
   - Hoisted from "@sentry#react-native#@sentry#browser"
   - Hoisted from "@sentry#react-native#@sentry#react#@sentry#browser"
info Disk size without dependencies: "2.02MB"
info Disk size with unique dependencies: "16.08MB"
info Disk size with transitive dependencies: "16.08MB"
info Number of shared dependencies: 5
✨  Done in 1.08s.

`yarn why @sentry/cli`
yarn why v1.22.10
[1/4] 🤔  Why do we have the module "@sentry/cli"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@sentry/[email protected]"
info Reasons this module exists
   - "@sentry#react-native" depends on it
   - Hoisted from "@sentry#react-native#@sentry#cli"
info Disk size without dependencies: "172KB"
info Disk size with unique dependencies: "908KB"
info Disk size with transitive dependencies: "1.55MB"
info Number of shared dependencies: 13
✨  Done in 0.98s.

`yarn why @sentry/core`
yarn why v1.22.10
[1/4] 🤔  Why do we have the module "@sentry/core"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@sentry/[email protected]"
info Reasons this module exists
   - "@sentry#react-native" depends on it
   - Hoisted from "@sentry#react-native#@sentry#core"
   - Hoisted from "@sentry#react-native#@sentry#browser#@sentry#core"
   - Hoisted from "@sentry#react-native#@sentry#react#@sentry#core"
   - Hoisted from "@sentry#react-native#@sentry#types#@sentry#core"
   - Hoisted from "@sentry#react-native#@sentry#utils#@sentry#core"
   - Hoisted from "@sentry#react-native#@sentry#browser#@sentry-internal#browser-utils#@sentry#core"
   - Hoisted from "@sentry#react-native#@sentry#browser#@sentry-internal#feedback#@sentry#core"
   - Hoisted from "@sentry#react-native#@sentry#browser#@sentry-internal#replay-canvas#@sentry#core"
   - Hoisted from "@sentry#react-native#@sentry#browser#@sentry-internal#replay#@sentry#core"
info Disk size without dependencies: "6.53MB"
info Disk size with unique dependencies: "6.53MB"
info Disk size with transitive dependencies: "6.53MB"
info Number of shared dependencies: 0
✨  Done in 1.05s.

`yarn why @sentry/react`
yarn why v1.22.10
[1/4] 🤔  Why do we have the module "@sentry/react"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@sentry/[email protected]"
info Reasons this module exists
   - "@sentry#react-native" depends on it
   - Hoisted from "@sentry#react-native#@sentry#react"
info Disk size without dependencies: "704KB"
info Disk size with unique dependencies: "9.36MB"
info Disk size with transitive dependencies: "16.93MB"
info Number of shared dependencies: 4
✨  Done in 1.00s.

`yarn why @sentry/types`
yarn why v1.22.10
[1/4] 🤔  Why do we have the module "@sentry/types"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@sentry/[email protected]"
info Reasons this module exists
   - "@sentry#react-native" depends on it
   - Hoisted from "@sentry#react-native#@sentry#types"
info Disk size without dependencies: "132KB"
info Disk size with unique dependencies: "6.66MB"
info Disk size with transitive dependencies: "6.66MB"
info Number of shared dependencies: 1
✨  Done in 0.98s.

`yarn why @sentry/utils`
yarn why v1.22.10
[1/4] 🤔  Why do we have the module "@sentry/utils"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@sentry/[email protected]"
info Reasons this module exists
   - "@sentry#react-native" depends on it
   - Hoisted from "@sentry#react-native#@sentry#utils"
info Disk size without dependencies: "380KB"
info Disk size with unique dependencies: "6.9MB"
info Disk size with transitive dependencies: "6.9MB"
info Number of shared dependencies: 1
✨  Done in 0.96s.

@getsantry getsantry bot moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 3 Jan 21, 2025
@krystofwoldrich
Copy link
Member

Thank you for all the details, the versions are correct.

Would you be able to able to reproduce this in an example project which you could share with us?

@getsantry getsantry bot moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 3 Feb 10, 2025
@asnaseer
Copy link
Author

I just updated to the latest version of apollo-link-sentry (version 4.1.0) and now see these logs:

 WARN  Sentry Logger [warn]: You appear to have multiple versions of the "promise" package installed. This may cause unexpected behavior like undefined `Promise.allSettled`. Please install the `promise` package manually using the exact version as the React Native package. See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.
 LOG  Sentry Logger [log]: Unhandled promise rejections will be caught by Sentry.
 LOG  Sentry Logger [log]: Integration installed: ReactNativeErrorHandlers
 LOG  Sentry Logger [log]: Integration installed: NativeLinkedErrors
 LOG  Sentry Logger [log]: Integration installed: InboundFilters
 LOG  Sentry Logger [log]: Integration installed: FunctionToString
 LOG  Sentry Logger [log]: Integration installed: Breadcrumbs
 LOG  Sentry Logger [log]: Integration installed: Dedupe
 LOG  Sentry Logger [log]: Integration installed: HttpContext
 LOG  Sentry Logger [log]: Integration installed: Release
 LOG  Sentry Logger [log]: Integration installed: EventOrigin
 LOG  Sentry Logger [log]: Integration installed: SdkInfo
 LOG  Sentry Logger [log]: Integration installed: ReactNativeInfo
 LOG  Sentry Logger [log]: Integration installed: RewriteFrames
 LOG  Sentry Logger [log]: Integration installed: DeviceContext
 LOG  Sentry Logger [log]: Integration installed: ModulesLoader
 LOG  Sentry Logger [log]: Integration installed: HermesProfiling
 LOG  Sentry Logger [log]: Integration installed: AppStart
 LOG  Sentry Logger [log]: Integration installed: NativeFrames
 LOG  Sentry Logger [log]: Integration installed: StallTracking
 LOG  Sentry Logger [log]: Integration installed: UserInteraction
 LOG  Sentry Logger [log]: Integration installed: ReactNativeTracing
 LOG  Sentry Logger [log]: Integration installed: DebugSymbolicator
 LOG  Sentry Logger [log]: Integration installed: ReactNativeProfiler
 DEBUG  Sentry Logger [debug]: [AppStart] App start tracking is enabled. App start will be added to the first transaction as a child span.
 LOG  Sentry Logger [log]: Integration installed: TouchEventBoundary
 LOG  Sentry Logger [log]: ReactNavigation Navigation container registered, but integration has not been setup yet.

This still has that last log line ReactNavigation Navigation container registered, but integration has not been setup yet. which is strange because we are definitely registering it after initialising Sentry.

Also, as soon as I navigate to another screen in our app it fails with these logs:

 LOG  Sentry Logger [log]: [TouchEvents] Touch event within element: View
 LOG  Sentry Logger [log]: [UserInteraction] User Interaction Tracing can not create transaction with undefined elementId.
 LOG  Sentry Logger [log]: [TouchEvents] Touch event within element: Path
 LOG  Sentry Logger [log]: [UserInteraction] User Interaction Tracing can not create transaction with undefined elementId.
 LOG  Sentry Logger [log]: [TouchEvents] Touch event within element: Text
 LOG  Sentry Logger [log]: [UserInteraction] User Interaction Tracing can not create transaction with undefined elementId.
 LOG  Sentry Logger [log]: [NATIVE] Start Profiling
 LOG  Sentry Logger [log]: [Profiling] started profiling:  b95781031efb465c8f0d77fc223af216
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetching frames for root span start (bb9696ac83c92f24).
 LOG  Sentry Logger [log]: [Tracing] Starting sampled root span
  op: navigation
  name: Route Change
  ID: bb9696ac83c92f24
 LOG  Sentry Logger [log]: [Tracing] Started span is an idle span
 LOG  Sentry Logger [log]: [startIdleNavigationSpan] Starting navigation transaction "Route Change" on scope
 LOG  Sentry Logger [log]: [Tracing] Starting sampled span
  op: navigation.processing
  name: Navigation dispatch to navigation cancelled or screen mounted
  ID: bd45317baf7417a8
  parent ID: bb9696ac83c92f24
  root ID: bb9696ac83c92f24
  root op: navigation
  root description: Route Change
 LOG  Sentry Logger [log]: [Tracing] Starting sampled span
  op: ui.load.initial_display
  name: DiscoverLandingPage initial display
  ID: 80492e38263b2ec5
  parent ID: bb9696ac83c92f24
  root ID: bb9696ac83c92f24
  root op: navigation
  root description: Route Change
 LOG  Sentry Logger [log]: [Tracing] Starting unsampled span
  op: < unknown op >
  name: < unknown name >
  ID: bc7fcfd23f410b78
  root ID: 8735b1609bd56075
 ERROR  TypeError: RNSentry.getNewScreenTimeToDisplay is not a function (it is undefined)

This error is located at:
    in BaseNavigationContainer
    in ThemeProvider
    in NavigationContainerInner (created by Navigation)
    in Navigation (created by App)
    in TextClassificationProvider (created by App)
    in CroppingViewMountedProvider (created by App)
    in MapStyleProvider (created by App)
    in SuggestionsProvider (created by App)
    in RCTView (created by View)
    in View (created by ActionSheet)
    in ActionSheet (created by ActionSheetProvider)
    in ActionSheetProvider (created by App)
    in RNCSafeAreaProvider (created by SafeAreaProvider)
    in SafeAreaProvider (created by App)
    in RevenueCatProvider (created by App)
    in GrowthBookProvider (created by App)
    in CachePersistorProvider (created by App)
    in ApolloProvider (created by App)
    in DatabaseProvider (created by App)
    in GlobalOnboardingProvider (created by App)
    in LoginProvider (created by App)
    in RCTView (created by View)
    in View (created by GestureHandlerRootView)
    in GestureHandlerRootView (created by App)
    in App (created by RootApp)
    in ReactNativeProfiler (created by RootApp)
    in RCTView (created by View)
    in View (created by __Sentry.TouchEventBoundary)
    in __Sentry.TouchEventBoundary (created by RootApp)
    in RootApp (created by withDevTools(RootApp))
    in withDevTools(RootApp)
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in main(RootComponent), js engine: hermes
 ERROR  TypeError: RNSentry.getNewScreenTimeToDisplay is not a function (it is undefined)

This error is located at:
    in BaseNavigationContainer
    in ThemeProvider
    in NavigationContainerInner (created by Navigation)
    in Navigation (created by App)
    in TextClassificationProvider (created by App)
    in CroppingViewMountedProvider (created by App)
    in MapStyleProvider (created by App)
    in SuggestionsProvider (created by App)
    in RCTView (created by View)
    in View (created by ActionSheet)
    in ActionSheet (created by ActionSheetProvider)
    in ActionSheetProvider (created by App)
    in RNCSafeAreaProvider (created by SafeAreaProvider)
    in SafeAreaProvider (created by App)
    in RevenueCatProvider (created by App)
    in GrowthBookProvider (created by App)
    in CachePersistorProvider (created by App)
    in ApolloProvider (created by App)
    in DatabaseProvider (created by App)
    in GlobalOnboardingProvider (created by App)
    in LoginProvider (created by App)
    in RCTView (created by View)
    in View (created by GestureHandlerRootView)
    in GestureHandlerRootView (created by App)
    in App (created by RootApp)
    in ReactNativeProfiler (created by RootApp)
    in RCTView (created by View)
    in View (created by __Sentry.TouchEventBoundary)
    in __Sentry.TouchEventBoundary (created by RootApp)
    in RootApp (created by withDevTools(RootApp))
    in withDevTools(RootApp)
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in main(RootComponent), js engine: hermes
 LOG  Sentry Logger [log]: [Tracing] Starting sampled span
  op: http.client
  name: POST https://staging.api.birda.org/graphql
  ID: 9c97e3673525f9c5
  parent ID: bb9696ac83c92f24
  root ID: bb9696ac83c92f24
  root op: navigation
  root description: Route Change
 LOG  Sentry Logger [log]: [Tracing] Starting sampled span
  op: http.client
  name: POST https://staging.api.birda.org/graphql
  ID: b5b478a285ac071b
  parent ID: bb9696ac83c92f24
  root ID: bb9696ac83c92f24
  root op: navigation
  root description: Route Change
 LOG  Sentry Logger [log]: [Tracing] Finishing "http.client" span "POST https://staging.api.birda.org/graphql" with ID b5b478a285ac071b
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetch frames for child span end (b5b478a285ac071b).
 LOG  Sentry Logger [log]: [Tracing] Finishing "http.client" span "POST https://staging.api.birda.org/graphql" with ID 9c97e3673525f9c5
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetch frames for child span end (9c97e3673525f9c5).
 LOG  updateViewedFeedItems    {"sessions":[{"id":"U2Vzc2lvbjpmMDZkOTMwMi1jYWU3LTQyZDYtYTkzMC0xYWFmN2YyYTc4NmM=","count":5}]}
 LOG  Sentry Logger [log]: [Tracing] Idle span "navigation" finished
 LOG  Sentry Logger [log]: [Tracing] Finishing "navigation" root span "Route Change" with ID bb9696ac83c92f24
 WARN  Sentry Logger [warn]: [NATIVE] Stop Profiling Failed: No Native Profile
 LOG  Sentry Logger [log]: [Profiling] finished profiling:  b95781031efb465c8f0d77fc223af216
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetch frames for root span end (bb9696ac83c92f24).
 LOG  Sentry Logger [log]: [StallTracking] Stall measurements not added due to a custom `endTimestamp` (root end is not equal to the latest child span end).
 LOG  Sentry Logger [log]: [StallTracking] Stall measurements not added due to `endTimestamp` not being close to now. endTimestamp 1739196364.3175924 now 1739196364.4006443
 DEBUG  Sentry Logger [debug]: Removing AppState listener for navigation transaction.
 LOG  Sentry Logger [log]: [Tracing] Discarding transaction because its trace was not chosen to be sampled.
 LOG  Sentry Logger [log]: Recording outcome: "sample_rate:transaction"
 ERROR  Sentry Logger [error]: Failed to receive any fallback timestamp.

@krystofwoldrich
Copy link
Member

The native code is out of sync with your JS code. Please rebuild the native part of the application (including pod install on iOS) and the RNSentry.getNewScreenTimeToDisplay should resolve.

@asnaseer
Copy link
Author

@krystofwoldrich D'oh! How could I have missed that obvious error - thanks for spotting it 👍

I built a new dev client, installed it on my device and re-ran the app to now see these logs:

 WARN  Sentry Logger [warn]: You appear to have multiple versions of the "promise" package installed. This may cause unexpected behavior like undefined `Promise.allSettled`. Please install the `promise` package manually using the exact version as the React Native package. See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.
 LOG  Sentry Logger [log]: Unhandled promise rejections will be caught by Sentry.
 LOG  Sentry Logger [log]: Integration installed: ReactNativeErrorHandlers
 LOG  Sentry Logger [log]: Integration installed: NativeLinkedErrors
 LOG  Sentry Logger [log]: Integration installed: InboundFilters
 LOG  Sentry Logger [log]: Integration installed: FunctionToString
 LOG  Sentry Logger [log]: Integration installed: Breadcrumbs
 LOG  Sentry Logger [log]: Integration installed: Dedupe
 LOG  Sentry Logger [log]: Integration installed: HttpContext
 LOG  Sentry Logger [log]: Integration installed: Release
 LOG  Sentry Logger [log]: Integration installed: EventOrigin
 LOG  Sentry Logger [log]: Integration installed: SdkInfo
 LOG  Sentry Logger [log]: Integration installed: ReactNativeInfo
 LOG  Sentry Logger [log]: Integration installed: RewriteFrames
 LOG  Sentry Logger [log]: Integration installed: DeviceContext
 LOG  Sentry Logger [log]: Integration installed: ModulesLoader
 LOG  Sentry Logger [log]: Integration installed: HermesProfiling
 LOG  Sentry Logger [log]: Integration installed: AppStart
 LOG  Sentry Logger [log]: Integration installed: NativeFrames
 LOG  Sentry Logger [log]: Integration installed: StallTracking
 LOG  Sentry Logger [log]: Integration installed: UserInteraction
 LOG  Sentry Logger [log]: Integration installed: ReactNativeTracing
 LOG  Sentry Logger [log]: Integration installed: DebugSymbolicator
 LOG  Sentry Logger [log]: Integration installed: ReactNativeProfiler
 DEBUG  Sentry Logger [debug]: [AppStart] App start tracking is enabled. App start will be added to the first transaction as a child span.
 LOG  Sentry Logger [log]: Integration installed: TouchEventBoundary
 LOG  Sentry Logger [log]: ReactNavigation Navigation container registered, but integration has not been setup yet.
 LOG  Sentry Logger [log]: [TouchEvents] Touch event within element: Path
 LOG  Sentry Logger [log]: [UserInteraction] User Interaction Tracing can not create transaction with undefined elementId.
 LOG  Sentry Logger [log]: [NATIVE] Start Profiling
 LOG  Sentry Logger [log]: [Profiling] started profiling:  e6363c1c365647bbb050a3800e47e39e
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetching frames for root span start (982c90dec7719977).
 LOG  Sentry Logger [log]: [Tracing] Starting sampled root span
  op: navigation
  name: Route Change
  ID: 982c90dec7719977
 LOG  Sentry Logger [log]: [Tracing] Started span is an idle span
 LOG  Sentry Logger [log]: [startIdleNavigationSpan] Starting navigation transaction "Route Change" on scope
 LOG  Sentry Logger [log]: [Tracing] Starting sampled span
  op: navigation.processing
  name: Navigation dispatch to navigation cancelled or screen mounted
  ID: b12bb76d32c827c9
  parent ID: 982c90dec7719977
  root ID: 982c90dec7719977
  root op: navigation
  root description: Route Change
 LOG  Sentry Logger [log]: [Tracing] Starting sampled span
  op: ui.load.initial_display
  name: DiscoverLandingPage initial display
  ID: bf51d8f5545e225c
  parent ID: 982c90dec7719977
  root ID: 982c90dec7719977
  root op: navigation
  root description: Route Change
 LOG  Sentry Logger [log]: [Tracing] Finishing "navigation.processing" span "Navigation dispatch to screen DiscoverLandingPage mounted" with ID b12bb76d32c827c9
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetch frames for child span end (b12bb76d32c827c9).
 LOG  Sentry Logger [log]: [Tracing] Starting sampled span
  op: http.client
  name: POST https://staging.api.birda.org/graphql
  ID: bbc9f24fa79e1396
  parent ID: 982c90dec7719977
  root ID: 982c90dec7719977
  root op: navigation
  root description: DiscoverLandingPage
 LOG  Sentry Logger [log]: [Tracing] Starting sampled span
  op: http.client
  name: POST https://staging.api.birda.org/graphql
  ID: 9f29b02d50ad8021
  parent ID: 982c90dec7719977
  root ID: 982c90dec7719977
  root op: navigation
  root description: DiscoverLandingPage
 LOG  Sentry Logger [log]: [Tracing] Finishing "ui.load.initial_display" span "DiscoverLandingPage initial display" with ID bf51d8f5545e225c
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetch frames for child span end (bf51d8f5545e225c).
 LOG  Sentry Logger [log]: [Tracing] Adding an event to span: time_to_initial_display
 LOG  Sentry Logger [log]: [Tracing] Finishing "http.client" span "POST https://staging.api.birda.org/graphql" with ID 9f29b02d50ad8021
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetch frames for child span end (9f29b02d50ad8021).
 LOG  Sentry Logger [log]: [Tracing] Finishing "http.client" span "POST https://staging.api.birda.org/graphql" with ID bbc9f24fa79e1396
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetch frames for child span end (bbc9f24fa79e1396).
 LOG  updateViewedFeedItems    {"sessions":[{"id":"U2Vzc2lvbjpmZDE5OWMxOS03NTllLTQzNDctOTlmOS1kMTk2MWE0ODczZmU=","count":1}]}
 LOG  Sentry Logger [log]: [Tracing] Idle span "navigation" finished
 LOG  Sentry Logger [log]: [Tracing] Finishing "navigation" root span "DiscoverLandingPage" with ID 982c90dec7719977
 WARN  Sentry Logger [warn]: [NATIVE] Stop Profiling Failed: No Native Profile
 LOG  Sentry Logger [log]: [Profiling] finished profiling:  e6363c1c365647bbb050a3800e47e39e
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetch frames for root span end (982c90dec7719977).
 LOG  Sentry Logger [log]: [Tracing] Adding an event to span: stall_count
 LOG  Sentry Logger [log]: [Tracing] Adding an event to span: stall_total_time
 LOG  Sentry Logger [log]: [Tracing] Adding an event to span: stall_longest_time
 DEBUG  Sentry Logger [debug]: Removing AppState listener for navigation transaction.
 LOG  Sentry Logger [log]: [Measurements] Adding measurements to transaction event {
  "time_to_initial_display": {
    "value": 346.3330268859863,
    "unit": "millisecond"
  },
  "stall_count": {
    "value": 1,
    "unit": "none"
  },
  "stall_total_time": {
    "value": 216.892578125,
    "unit": "millisecond"
  },
  "stall_longest_time": {
    "value": 216.892578125,
    "unit": "millisecond"
  }
}
 DEBUG  Sentry Logger [debug]: [AppStart] Added app start spans to transaction event. [
  {
    "status": "ok",
    "op": "app.start.cold",
    "description": "Cold App Start",
    "start_timestamp": 1739266359.770192,
    "timestamp": 1739266436.2823985,
    "trace_id": "391cf7288bb7477382689a966dd523ed",
    "parent_span_id": "982c90dec7719977",
    "origin": "auto.app.start",
    "span_id": "a03b27d54b6989f0",
    "data": {
      "sentry.op": "app.start.cold",
      "sentry.origin": "auto.app.start"
    }
  },
  {
    "status": "ok",
    "op": "app.start.cold",
    "trace_id": "391cf7288bb7477382689a966dd523ed",
    "parent_span_id": "a03b27d54b6989f0",
    "origin": "auto.app.start",
    "description": "JS Bundle Execution Before React Root",
    "start_timestamp": 1739266433.0037966,
    "timestamp": 1739266436.2450702,
    "span_id": "b20123dea97503c2",
    "data": {
      "sentry.op": "app.start.cold",
      "sentry.origin": "auto.app.start"
    }
  },
  {
    "status": "ok",
    "op": "app.start.cold",
    "trace_id": "391cf7288bb7477382689a966dd523ed",
    "parent_span_id": "a03b27d54b6989f0",
    "origin": "auto.app.start",
    "description": "UIKit Init to JS Exec Start",
    "start_timestamp": 1739266361.4005709,
    "timestamp": 1739266433.0037935,
    "span_id": "a6d51e807fda5057",
    "data": {
      "sentry.op": "app.start.cold",
      "sentry.origin": "auto.app.start"
    }
  }
]
 DEBUG  Sentry Logger [debug]: [AppStart] Added app start measurement to transaction event. {
  "value": 76512.20654296875,
  "unit": "millisecond"
}
 DEBUG  Sentry Logger [debug]: [NativeFrames] Using native frames from last child span end (spanId, 982c90dec7719977).
 LOG  Sentry Logger [log]: [NativeFrames] Adding measurements to ui.load transaction DiscoverLandingPage: {
  "frames_total": {
    "value": 28,
    "unit": "none"
  },
  "frames_frozen": {
    "value": 0,
    "unit": "none"
  },
  "frames_slow": {
    "value": 5,
    "unit": "none"
  }
}
 LOG  Sentry Logger [log]: [Profiling] Created profile e6363c1c365647bbb050a3800e47e39e for transaction 88adcc0fb0574029b186b0d593984c65

This still has that log line ReactNavigation Navigation container registered, but integration has not been setup yet. which is strange because we are definitely registering it after initialising Sentry.

The good news is that in the Sentry web page, if I click on Mobile in the left-hand-panel, I now see data in al the tabs: Overview, App Starts, Screen Loads, Screen Rendering, Network Requests. So its just that strange log message left to resolve.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Feb 11, 2025
@stefanosiano
Copy link
Member

thanks for the update @asnaseer
So we can consider this issue closed.
@krystofwoldrich let's have a look at why the log message is still printed

@asnaseer
Copy link
Author

@stefanosiano

So we can consider this issue closed.

As long as that log message is benign and does not indicate any serious issue, then I would be happy for you to close this issue.

@krystofwoldrich
Copy link
Member

Hi @asnaseer,
that's awesome to hear, thank you for the message.

ReactNavigation Navigation container registered, but integration has not been setup yet. is not a serious issue, but it means registerNavigationContainer is called before Sentry.init.

Usually, this means that Sentry.init called after the root React component is mounted/during it's mounting. Generally, we recommend to call init before any React rendering starts.

@asnaseer
Copy link
Author

@krystofwoldrich If you look at my comment above: #4438 (comment)

You will see that I do indeed call Sentry.init before calling registerRootComponent(Sentry.wrap(App)); in my index.js file.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Feb 12, 2025
@krystofwoldrich
Copy link
Member

krystofwoldrich commented Feb 12, 2025

Thank you for pointing back to the comment, I see now. Then you can ignore the message.

@github-project-automation github-project-automation bot moved this from Needs More Information to Done in Mobile SDKs Feb 12, 2025
@asnaseer
Copy link
Author

@krystofwoldrich Sorry, I made a mistake when I said:

The good news is that in the Sentry web page, if I click on Mobile in the left-hand-panel, I now see data in al the tabs: Overview, App Starts, Screen Loads, Screen Rendering, Network Requests.

The tabs App Starts, Screen Loads, and Screen Rendering all just display No results found for your query when running my app locally. I waited for up to 15 minutes and kept refreshing these tabs but they just don't show any results. They do show actual results for our released app.

@krystofwoldrich
Copy link
Member

krystofwoldrich commented Mar 3, 2025

Thank you for the message.
Could you share which filters you have selected? Is it possible that you are looking at a different time range or environment?

@asnaseer
Copy link
Author

asnaseer commented Mar 4, 2025

I started the app up locally using yarn start and then scanned the QR code from my iPhone. I then navigated to our DiscoverLandingPage. I saw these Sentry log statements in the console output:

 LOG  Sentry Logger [log]: Unhandled promise rejections will be caught by Sentry.
 LOG  Sentry Logger [log]: Integration installed: ReactNativeErrorHandlers
 LOG  Sentry Logger [log]: Integration installed: NativeLinkedErrors
 LOG  Sentry Logger [log]: Integration installed: InboundFilters
 LOG  Sentry Logger [log]: Integration installed: FunctionToString
 LOG  Sentry Logger [log]: Integration installed: Breadcrumbs
 LOG  Sentry Logger [log]: Integration installed: Dedupe
 LOG  Sentry Logger [log]: Integration installed: HttpContext
 LOG  Sentry Logger [log]: Integration installed: Release
 LOG  Sentry Logger [log]: Integration installed: EventOrigin
 LOG  Sentry Logger [log]: Integration installed: SdkInfo
 LOG  Sentry Logger [log]: Integration installed: ReactNativeInfo
 LOG  Sentry Logger [log]: Integration installed: RewriteFrames
 LOG  Sentry Logger [log]: Integration installed: DeviceContext
 LOG  Sentry Logger [log]: Integration installed: ModulesLoader
 LOG  Sentry Logger [log]: Integration installed: HermesProfiling
 LOG  Sentry Logger [log]: Integration installed: AppStart
 LOG  Sentry Logger [log]: Integration installed: NativeFrames
 LOG  Sentry Logger [log]: Integration installed: StallTracking
 LOG  Sentry Logger [log]: Integration installed: UserInteraction
 LOG  Sentry Logger [log]: Integration installed: ReactNativeTracing
 LOG  Sentry Logger [log]: Integration installed: DebugSymbolicator
 LOG  Sentry Logger [log]: Integration installed: ReactNativeProfiler
 DEBUG  Sentry Logger [debug]: [AppStart] App start tracking is enabled. App start will be added to the first transaction as a child span.
 LOG  Sentry Logger [log]: Integration installed: TouchEventBoundary
 LOG  Sentry Logger [log]: ReactNavigation Navigation container registered, but integration has not been setup yet.
 LOG  Sentry Logger [log]: [TouchEvents] Touch event within element: View
 LOG  Sentry Logger [log]: [UserInteraction] User Interaction Tracing can not create transaction with undefined elementId.
 LOG  Sentry Logger [log]: [NATIVE] Start Profiling
 LOG  Sentry Logger [log]: [Profiling] started profiling:  399389671f24405bb543d2a4663cddae
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetching frames for root span start (a6fb49662b0d7d86).
 LOG  Sentry Logger [log]: [Tracing] Starting sampled root span
  op: navigation
  name: Route Change
  ID: a6fb49662b0d7d86
 LOG  Sentry Logger [log]: [Tracing] Started span is an idle span
 LOG  Sentry Logger [log]: [startIdleNavigationSpan] Starting navigation transaction "Route Change" on scope
 LOG  Sentry Logger [log]: [Tracing] Starting sampled span
  op: navigation.processing
  name: Navigation dispatch to navigation cancelled or screen mounted
  ID: 8833718f1d1c4c06
  parent ID: a6fb49662b0d7d86
  root ID: a6fb49662b0d7d86
  root op: navigation
  root description: Route Change
 LOG  Sentry Logger [log]: [Tracing] Starting sampled span
  op: ui.load.initial_display
  name: DiscoverLandingPage initial display
  ID: a6e8526a728c7f37
  parent ID: a6fb49662b0d7d86
  root ID: a6fb49662b0d7d86
  root op: navigation
  root description: Route Change
 LOG  Sentry Logger [log]: [Tracing] Finishing "navigation.processing" span "Navigation dispatch to screen DiscoverLandingPage mounted" with ID 8833718f1d1c4c06
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetch frames for child span end (8833718f1d1c4c06).
 LOG  Sentry Logger [log]: [Tracing] Finishing "ui.load.initial_display" span "DiscoverLandingPage initial display" with ID a6e8526a728c7f37
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetch frames for child span end (a6e8526a728c7f37).
 LOG  Sentry Logger [log]: [Tracing] Adding an event to span: time_to_initial_display
 LOG  Sentry Logger [log]: [Tracing] Idle span "navigation" finished
 LOG  Sentry Logger [log]: [Tracing] Finishing "navigation" root span "DiscoverLandingPage" with ID a6fb49662b0d7d86
 WARN  Sentry Logger [warn]: [NATIVE] Stop Profiling Failed: No Native Profile
 LOG  Sentry Logger [log]: [Profiling] finished profiling:  399389671f24405bb543d2a4663cddae
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetch frames for root span end (a6fb49662b0d7d86).
 LOG  Sentry Logger [log]: [Tracing] Adding an event to span: stall_count
 LOG  Sentry Logger [log]: [Tracing] Adding an event to span: stall_total_time
 LOG  Sentry Logger [log]: [Tracing] Adding an event to span: stall_longest_time
 DEBUG  Sentry Logger [debug]: Removing AppState listener for navigation transaction.
 LOG  Sentry Logger [log]: [Measurements] Adding measurements to transaction event {
  "time_to_initial_display": {
    "value": 419.05999183654785,
    "unit": "millisecond"
  },
  "stall_count": {
    "value": 1,
    "unit": "none"
  },
  "stall_total_time": {
    "value": 271.64404296875,
    "unit": "millisecond"
  },
  "stall_longest_time": {
    "value": 271.64404296875,
    "unit": "millisecond"
  }
}
 DEBUG  Sentry Logger [debug]: [AppStart] Added app start spans to transaction event. [
  {
    "status": "ok",
    "op": "app.start.cold",
    "description": "Cold App Start",
    "start_timestamp": 1741076944.209253,
    "timestamp": 1741077005.3201547,
    "trace_id": "f68a013aab244c3185a086d7cc5d9d9f",
    "parent_span_id": "a6fb49662b0d7d86",
    "origin": "auto.app.start",
    "span_id": "a3c5bd750331d2e0",
    "data": {
      "sentry.op": "app.start.cold",
      "sentry.origin": "auto.app.start"
    }
  },
  {
    "status": "ok",
    "op": "app.start.cold",
    "trace_id": "f68a013aab244c3185a086d7cc5d9d9f",
    "parent_span_id": "a3c5bd750331d2e0",
    "origin": "auto.app.start",
    "description": "JS Bundle Execution Before React Root",
    "start_timestamp": 1741077001.9097803,
    "timestamp": 1741077005.2757137,
    "span_id": "aedfc3629079ca43",
    "data": {
      "sentry.op": "app.start.cold",
      "sentry.origin": "auto.app.start"
    }
  },
  {
    "status": "ok",
    "op": "app.start.cold",
    "trace_id": "f68a013aab244c3185a086d7cc5d9d9f",
    "parent_span_id": "a3c5bd750331d2e0",
    "origin": "auto.app.start",
    "description": "UIKit Init to JS Exec Start",
    "start_timestamp": 1741076944.761467,
    "timestamp": 1741077001.9097118,
    "span_id": "96489f1a6e8808a5",
    "data": {
      "sentry.op": "app.start.cold",
      "sentry.origin": "auto.app.start"
    }
  }
]
 DEBUG  Sentry Logger [debug]: [AppStart] Added app start measurement to transaction event. {
  "value": 61110.901611328125,
  "unit": "millisecond"
}
 DEBUG  Sentry Logger [debug]: [NativeFrames] Using native frames from last child span end (spanId, a6fb49662b0d7d86).
 LOG  Sentry Logger [log]: [NativeFrames] Adding measurements to ui.load transaction DiscoverLandingPage: {
  "frames_total": {
    "value": 22,
    "unit": "none"
  },
  "frames_frozen": {
    "value": 0,
    "unit": "none"
  },
  "frames_slow": {
    "value": 1,
    "unit": "none"
  }
}
 LOG  Sentry Logger [log]: [Profiling] Created profile 399389671f24405bb543d2a4663cddae for transaction 8866a8cec06944088878d0e4b1fd0d1d

I then went to the Sentry website and selected birda as the project and development as the environment and saw this output when selecting Mobile from the left-hand panel:

Image

I then clicked on the Mobile Vitals tab and saw this output which, as you see, does not show any data for the app start stats:

Image

As a reminder, this is how we initialise Sentry:

Sentry.init({
    dsn: "https://...",
    enableAppStartTracking: true,
    enableNativeFramesTracking: true,
    enableStallTracking: true,
    enableUserInteractionTracing: true,
    enableAutoSessionTracking: true,
    enableAutoPerformanceTracing: true,
    environment: __DEV__ ? "development" : "production",
    debug: __DEV__ && enableDebugSentry,
    enableNative: true,
    integrations: (integrations) => {
      return [
        ...integrations,
        Sentry.hermesProfilingIntegration({ platformProfilers: false }),
      ];
    },
    tracesSampleRate: __DEV__ ? 1 : 0.1,
    profilesSampleRate: __DEV__ ? 1 : 0.1,
    maxValueLength: 2048,
  });

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

No branches or pull requests

5 participants