Skip to content
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

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

Open
dalnoki opened this issue Jan 28, 2025 · 1 comment · May be fixed by getsentry/sentry-docs#12496
Open

Comments

@dalnoki
Copy link

dalnoki commented Jan 28, 2025

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.

@krystofwoldrich
Copy link
Member

Thank you for the message, the docs page was out of date.

@krystofwoldrich krystofwoldrich moved this from Needs Discussion to Needs Review in Mobile & Cross Platform SDK Jan 28, 2025
@krystofwoldrich krystofwoldrich self-assigned this Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: Needs Review
Development

Successfully merging a pull request may close this issue.

2 participants