startTransaction method no longer returning transaction
See original GitHub issueIs there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Saas (sentry.io)
Which package are you using?
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:
- Created 2 years ago
- Reactions:13
- Comments:24 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 useTracing
somewhere in your project.@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: