question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

startTransaction method no longer returning transaction

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:13
  • Comments:24 (6 by maintainers)

github_iconTop GitHub Comments

15reactions
onurtemizkancommented, Mar 22, 2022

You can use: import "@sentry/tracing" when importing @sentry/node as a temporary workaround while we’re working on this.

Name-space imports such as: import * as Tracing from "@sentry/tracing" currently don’t inject relevant functionality unless you specifically use Tracing somewhere in your project.

10reactions
lforstcommented, May 13, 2022

@JVMartin just checked back with the rest of the team. In short: The way you’ve set up things right now is the intended and correct way. We have updated the docs to list import '@sentry/tracing'; as a required import statement.

For anyone stumbling onto this issue, please import as follows for tracing to work:

import * as Sentry from "@sentry/node";
import "@sentry/tracing";
Read more comments on GitHub >

github_iconTop Results From Across the Web

Session.startTransaction() — MongoDB Manual
While the transaction is open, no data changes made by operations in the transaction is visible outside the transaction: When a transaction commits,...
Read more >
StartTransaction and EndTransaction - SAP Community
The global transaction mode will be terminated whenever DI API encounters any error (exception or error indicated via return codes).
Read more >
StartTransaction - GoXam - Northwoods Software
Without the extension method, some of my model changes are not within a transaction, which is bad. walter ...
Read more >
ITransactionLocal::StartTransaction - Microsoft Learn
The value of the top-level transaction is 1. If pulTransactionLevel is a null pointer, the level is not returned. Return Code. S_OK The...
Read more >
13.3.1 START TRANSACTION, COMMIT, and ROLLBACK ...
3, “Optimizing InnoDB Read-Only Transactions” for more information. If no access mode is specified, the default mode applies. Unless the default has been ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found