Skip to content

startTransaction method no longer returning transaction #4731

Closed
@crice88

Description

@crice88

Is there an existing issue for this?

How do you use Sentry?

Saas (sentry.io)

Which package are you using?

@sentry/node

SDK Version

6.18.2

Framework Version

No response

Link to Sentry event

No response

Steps to Reproduce

We are using Nestjs and create spanned transactions for logging. Recently upgraded from 6.11.0 to 6.18.2 and began seeing the issue. Here's just a bit of sample usage:

const { method, headers, url } = this.request;
    const transaction = Sentry.startTransaction({
      name: `Route: ${method} ${url}`,
      op: 'transaction'
    });

    Sentry.getCurrentHub().configureScope((scope) => {
      scope.setSpan(transaction);
      scope.setContext('http', {
        method,
        url,
        headers
      });
    });

Transaction is undefined in this instance so a scope is never configured. I have tested the startTransaction method in two separate projects and both are experiencing the same issue. Downgrading library back to 6.11.0 fixes the issue.

Expected Result

startTransaction method should return an instance of transaction so it can be used for proper scoping.

Actual Result

When pulling the scoped span via Sentry.getCurrentHub().getScope()?.getSpan(); I am receiving undefined as the span was never created properly due to the transaction being undefined.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions