Skip to content

Commit 2d7ccba

Browse files
committed
fix: Node
1 parent 045fd88 commit 2d7ccba

File tree

1 file changed

+5
-3
lines changed
  • packages/node/src/integrations

1 file changed

+5
-3
lines changed

packages/node/src/integrations/http.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getCurrentHub } from '@sentry/core';
2-
import { Integration, Span } from '@sentry/types';
2+
import { Integration, Span, Transaction } from '@sentry/types';
33
import { fill, parseSemver } from '@sentry/utils';
44
import * as http from 'http';
55
import * as https from 'https';
@@ -79,15 +79,17 @@ function createHandlerWrapper(
7979
}
8080

8181
let span: Span | undefined;
82+
let transaction: Transaction | undefined;
8283

8384
const scope = getCurrentHub().getScope();
8485
if (scope && tracingEnabled) {
85-
scope.getTransaction(transaction => {
86+
transaction = scope.getTransaction();
87+
if (transaction) {
8688
span = transaction.startChild({
8789
description: `${typeof options === 'string' || !options.method ? 'GET' : options.method} ${requestUrl}`,
8890
op: 'request',
8991
});
90-
});
92+
}
9193
}
9294

9395
return originalHandler

0 commit comments

Comments
 (0)