Expo Sentry ReactNativeTracing 启动时无限循环

问题描述 投票:0回答:1

我有一个 Expo 应用程序,添加了 Sentry,但是一旦我启用

Sentry.Native.ReactNativeTracing
集成,它就会陷入错误的无限循环。

 LOG  Sentry Logger [log]: Integration installed: ModulesLoader
 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: Release
 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: NativeLinkedErrors
 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]: [ReactNativeTracing] Native frames instrumentation initialized.
 LOG  Sentry Logger [log]: Setting idle transaction on scope. Span ID: a7bae05c7f745660
 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]: [ReactNativeTracing] Starting navigation transaction "Route Change" on scope
 LOG  Sentry Logger [log]: Integration installed: ReactNativeTracing
 LOG  Sentry Logger [log]: Integration installed: ExpoManagedIntegration
 LOG  Sentry Logger [log]: Integration installed: react-navigation-v5
 LOG  Sentry Logger [log]: Integration installed: ReactNativeUserInteractionTracing
 ERROR  Sentry Logger [error]: [ReactNativeTracing] Error while fetching native frames: SentryError: Native is disabled
 LOG  Sentry Logger [log]: [Tracing] pushActivity: a8b90f2e57a3d4c4
 LOG  Sentry Logger [log]: [Tracing] new activities count 1
 LOG  Sentry Logger [log]: [Tracing] Starting 'http.client' span on transaction 'Route Change' (a7bae05c7f745660).
 LOG  Sentry Logger [log]: [Tracing] pushActivity: a9286f6ffee98601
 LOG  Sentry Logger [log]: [Tracing] new activities count 2
 LOG  Sentry Logger [log]: [Tracing] Starting 'http.client' span on transaction 'Route Change' (a7bae05c7f745660).
 LOG  Sentry Logger [log]: [Tracing] pushActivity: af6b790f32eefc62
 LOG  Sentry Logger [log]: [Tracing] new activities count 3
 LOG  Sentry Logger [log]: [Tracing] Starting 'http.client' span on transaction 'Route Change' (a7bae05c7f745660).
 LOG  Sentry Logger [log]: [Tracing] popActivity a8b90f2e57a3d4c4
 LOG  Sentry Logger [log]: [Tracing] new activities count 2
 ERROR  Sentry Logger [error]: [ReactNativeTracing] Error while fetching native frames: SentryError: Native is disabled
 LOG  Sentry Logger [log]: [Tracing] pushActivity: 8bebd01e9ff1b77a
 LOG  Sentry Logger [log]: [Tracing] new activities count 3
 LOG  Sentry Logger [log]: [Tracing] Starting 'http.client' span on transaction 'Route Change' (a7bae05c7f745660).
 LOG  Sentry Logger [log]: [Tracing] popActivity a9286f6ffee98601
 LOG  Sentry Logger [log]: [Tracing] new activities count 2
 ERROR  Sentry Logger [error]: [ReactNativeTracing] Error while fetching native frames: SentryError: Native is disabled
 LOG  Sentry Logger [log]: [Tracing] pushActivity: a68f7f0efbec741a
 LOG  Sentry Logger [log]: [Tracing] new activities count 3
 LOG  Sentry Logger [log]: [Tracing] Starting 'http.client' span on transaction 'Route Change' (a7bae05c7f745660).
 LOG  Sentry Logger [log]: [Tracing] popActivity af6b790f32eefc62
 LOG  Sentry Logger [log]: [Tracing] new activities count 2
 ERROR  Sentry Logger [error]: [ReactNativeTracing] Error while fetching native frames: SentryError: Native is disabled
 LOG  Sentry Logger [log]: [Tracing] pushActivity: 90fdf22a5d90fb8f
 LOG  Sentry Logger [log]: [Tracing] new activities count 3
 LOG  Sentry Logger [log]: [Tracing] Starting 'http.client' span on transaction 'Route Change' (a7bae05c7f745660).
 LOG  Sentry Logger [log]: [Tracing] popActivity 8bebd01e9ff1b77a
 LOG  Sentry Logger [log]: [Tracing] new activities count 2
 ERROR  Sentry Logger [error]: [ReactNativeTracing] Error while fetching native frames: SentryError: Native is disabled

我尝试阅读有关 Sentry 的博览会文档、Sentry 文档、随机 GitHub 问题,但无法找出导致此错误的原因。

我的

routingInstrumentation
设置如下所示:

import * as Sentry from 'sentry-expo';

// Construct a new instrumentation instance. This is needed to communicate between the integration and React
const routingInstrumentation = new Sentry.Native.ReactNavigationInstrumentation();

const Root = () => {
  const [isFetchingToken, setIsFetchingToken] = useState(true);
  const authCtx = useContext(AuthContext);

  if (isFetchingToken)
    return (
      <View>
        <Text>Loading...</Text>
      </View>
    );

  // Checking auth state, fetching token etc...

  return (
    <NavigationContainer
      ref={navigationRef}
      onReady={() => {
        // Register the navigation container with the instrumentation
        routingInstrumentation.registerNavigationContainer(navigationRef);
      }}>
      {authCtx.isAuthenticated ? <MainStackNavigator /> : <AuthNavigator />}
    </NavigationContainer>
  );

我的

Sentry.init

Sentry.init({
  dsn: 'my-dsn',
  enableInExpoDevelopment: true,
  enableNative: true,
  debug: !isProduction, // * If `true`, Sentry will try to print out useful debugging information if something goes wrong with sending the event. Set it to `false` in production

  // * Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
  // * We recommend adjusting this value in production.
  sampleRate: isProduction ? 0.2 : 1.0,
  tracesSampleRate: isProduction ? 0.2 : 1.0,

  integrations: [
    new Sentry.Native.ReactNativeTracing({
      routingInstrumentation,
      enableAppStartTracking: false,
      enableStallTracking: true,
      enableUserInteractionTracing: true,
      enableNativeFramesTracking: true,
    }),
  ],
});

也已经用

Sentry.Native.init
尝试过,仍然无限循环。

typescript react-native expo sentry
1个回答
0
投票

我也看到了这一点 - 尝试将其添加到你的 ReactNativeTracing 选项中:

shouldCreateSpanForRequest: (url) => {
  return (
    !__DEV__ ||
    !url.startsWith(`http://${Constants.expoConfig?.hostUri}/logs`)
  );
}

我现在找不到它的原始来源......但似乎对我有用

© www.soinside.com 2019 - 2024. All rights reserved.