Skip to content

Commit 0f66175

Browse files
committed
perf(node): Remove normalizedRequest from scope after response is closed
1 parent 9b27aa8 commit 0f66175

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/node/src/integrations/http/SentryHttpInstrumentation.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ export class SentryHttpInstrumentation extends InstrumentationBase<SentryHttpIns
183183
});
184184
}
185185

186+
response.once('close', () => {
187+
// Remove normalized request from the scope after the response is finished
188+
// This is to avoid keeping the request body in memory for too long.
189+
isolationScope.setSDKProcessingMetadata({ normalizedRequest: undefined });
190+
});
191+
186192
return withIsolationScope(isolationScope, () => {
187193
return withScope(scope => {
188194
// Set a new propagationSpanId for this request

0 commit comments

Comments
 (0)