Skip to content

Invariant Violation when passing an object with Infinity into addBreadcrumb #4024

Closed
@thomasttvo

Description

@thomasttvo

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

SDK:

  • @sentry/react-native (>= 1.0.0)
  • react-native-sentry (<= 0.43.2)

SDK version: 5.29.0

react-native version: 0.73.5

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

Calling addBreadcrumb on Android with an Infinity value throws an error, which may crash the app in certain cases. We don't usually mean to call it with an Infinity value, but it's hard to control what's being logged automatically.

I think at the very least, Sentry should wrap its methods around try/catch internally and log the errors to avoid them affecting the main application?

try {
  Sentry.addBreadcrumb({
     category: 'redux.action',
     type: 'info',
     data: { x: Infinity },
  });
} catch(e) {
  console.log(e)
}
Invariant Violation: [{"timestamp":1723673438.573,"category":"redux.action","type":"info","data":{"x":"<<Infinity>>"},"level":"info"}] is not usable as a native method argument, js engine: hermes

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions