Skip to content

getCurrentScope().getTransaction() is undefined in Sentry React Native v6.5.0 #4488

@dalnoki

Description

@dalnoki

What React Native libraries do you use?

Hermes

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?

Sentry.init()

Steps to Reproduce

The customer is trying to set performance metrics in a React Native app as described in the Sentry documentation on performance metrics. However, when using Sentry React Native v6.5.0, the snippet below fails with an error:

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

const transaction = Sentry.getCurrentScope().getTransaction();
// Record amount of memory used
transaction.setMeasurement("memoryUsed", 123, "byte");

TypeError: Sentry.getCurrentScope().getTransaction is not a function (it is undefined)

Expected Result

I expect Sentry.getCurrentScope() to return a scope object with getTransaction(), per the documentation.

Actual Result

The customer gets an error that getTransaction() is undefined, and cannot record the measurement.

Metadata

Metadata

Labels

No labels
No labels

Projects

Status

Done

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions