Skip to content

Sentry.captureMessage events have a wrong title different from the message #86773

Open
@aleks-khomenko

Description

@aleks-khomenko

Originally surfaced in RN SDK, but the issue is not SDK specific.

See comment for examples and expected behavior.


What React Native libraries do you use?

React Native without Frameworks

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

6.6.0

How does your development environment look like?

System:
OS: macOS 14.6.1
CPU: (10) arm64 Apple M1 Pro
Memory: 79.50 MB / 32.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.9.0
path: ~/.asdf/installs/nodejs/20.9.0/bin/node
Yarn: Not Found
npm:
version: 10.1.0
path: ~/.asdf/plugins/nodejs/shims/npm
Watchman:
version: 2024.04.15.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /Users/alekskhomenko/.asdf/shims/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: 2024.2 AI-242.23726.103.2422.12816248
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: /Users/alekskhomenko/.asdf/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.73.8
wanted: 0.73.8
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false

Sentry.init()

Sentry.init(SentryService.setupConfig());
const App = () => {
return (






);
};

export default Sentry.wrap(App);

Steps to Reproduce

recently I've updated sentry from 5.36.0 to 6.6.0
Now when I review issues in my account, all events get same title Sentry.withScope$argument_0
I didn't change my handler

Image
export const navigationIntegration = Sentry.reactNavigationIntegration();
const setupConfig = (): ReactNativeOptions => ({
  dsn: Config.SENTRY_DSN,
  environment: Config.SENTRY_ENV || 'development',
  debug: false,
  attachStacktrace: true,
  enableAutoSessionTracking: true,
  sessionTrackingIntervalMillis: 10000,
  normalizeDepth: 4,
  tracesSampler: samplingContext => {
    if (samplingContext.name === 'Route Change') {
      // Drop this transaction
      return 0.3;
    } else {
      // Default sample rate
      return 1;
    }
  },
  beforeBreadcrumb: (breadcrumb: Sentry.Breadcrumb) => {
    return breadcrumb.category === 'console' ? null : breadcrumb;
  },
  replaysSessionSampleRate: getReplaySampleRate(),
  replaysOnErrorSampleRate: getReplaySampleRate('onError'),
  integrations: [
    navigationIntegration,
    Sentry.reactNativeTracingIntegration(),
    Sentry.mobileReplayIntegration({
      maskAllText: false,
      maskAllImages: false,
      maskAllVectors: false,
    }),
  ],
});
const captureRuntimeException = ({ error, path }: RuntimeException) => {
  Sentry.withScope(scope => {
    setUserScope(scope);

    scope.setTag('path', path);

    scope.setExtra('error', error);

    if (isFetchBaseQueryError(error) && typeof error.status === 'string') {
      Sentry.captureMessage(`${error.status} ${error.error}`);
    } else if (isBackendError(error)) {
      scope.setLevel('warning');
      Sentry.captureMessage(`${error.data.errorCode} `);
    } else if (isErrorWithMessage(error) && !(error as any)?.stack) {
      Sentry.captureMessage(error.message);
    } else {
      Sentry.captureException(error);
    }
  });
};

Expected Result

Events title should be mapped correctly like in version 5.36.0

Actual Result

Image

Metadata

Metadata

Type

Projects

Status

Needs Discussion

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions