-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issuesI have reviewed the documentation https://docs.sentry.io/I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releasesTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
9.24.0
Framework Version
No response
Link to Sentry event
No response
Reproduction Example/SDK Setup
No response
Steps to Reproduce
Stacktrace:
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ClientRequest.setHeader (node:_http_outgoing:642:11)
at SentryHttpInstrumentation._onOutgoingRequestCreated (/Users/finn/workspaces/typie/node_modules/.pnpm/@sentry+node@9.24.0/node_modules/@sentry/node/src/integrations/http/SentryHttpInstrumentation.ts:265:15)
at onHttpClientRequestCreated (/Users/finn/workspaces/typie/node_modules/.pnpm/@sentry+node@9.24.0/node_modules/@sentry/node/src/integrations/http/SentryHttpInstrumentation.ts:167:12)
at Channel.publish (node:diagnostics_channel:150:9)
at new ClientRequest (node:_http_client:384:35)
at request (node:https:381:10)
at /Users/finn/workspaces/typie/node_modules/.pnpm/@smithy+node-http-handler@4.0.6/node_modules/@smithy/node-http-handler/dist-cjs/index.js:366:19
at new Promise (<anonymous>)
at _NodeHttpHandler.handle (/Users/finn/workspaces/typie/node_modules/.pnpm/@smithy+node-http-handler@4.0.6/node_modules/@smithy/node-http-handler/dist-cjs/index.js:300:12)
at /Users/finn/workspaces/typie/node_modules/.pnpm/@smithy+smithy-client@4.4.1/node_modules/@smithy/smithy-client/dist-cjs/index.js:155:35 {
code: 'ERR_HTTP_HEADERS_SENT'
Sentry initialization:
Sentry.init({
dsn: "<actual dsn>",
});Code that causes trouble:
await aws.s3.send(
new PutObjectCommand({
Bucket: '<bucket name>',
Key: `<some key>`,
Body: <buffer>,
}),
);package.json:
"@aws-sdk/client-s3": "^3.812.0",
"@sentry/node": "^9.24.0",
node -v:
v24.1.0
As a temporary workaround, setting tracePropagationTargets: [] solves the issue.
Expected Result
Code works well.
Actual Result
It does not.
evanrblack, itsjgf, seghis, RubenZx, KROSF and 2 more
Metadata
Metadata
Assignees
Projects
Status
No status
Activity
andreiborza commentedon Jun 2, 2025
Hi @devunt, thanks for filing this.
I tried to replicate this here but couldn't. Could you please provide a reproduction repo or try to see what's different from mine?
mzoellner-sc commentedon Jun 3, 2025
Running into the same issue on a few projects. It looks like this was introduced in 9.23.0.
The error bubbles all the way up as an uncaught exception.
andreiborza commentedon Jun 3, 2025
@mzoellner-sc thank you. Are you doing anything different from my attempt to reproduce here? Any chance you could share a reproduction?
devunt commentedon Jun 3, 2025
Hi @andreiborza, My code had sent
GetObjectcommand a few lines before the issue-causingPutObjectcommand. I'll prepare the reproduction code.15 remaining items
itsjgf commentedon Jun 3, 2025
@andreiborza Wouldn’t it be better to downgrade Sentry to 9.22.0? As others have mentioned above, the error bubbles up as an uncaught exception and, in our case, this is causing our pods to restart.
andreiborza commentedon Jun 3, 2025
The problem exists in
9.22.0as well (if you completely disable spans) which is why I recommended downgrading node instead. That being said, if downgrading to9.22.0works for your case, that's an easier downgrade.fix(node): Ensure adding sentry-trace and baggage headers via
fix(node): Ensure adding sentry-trace and baggage headers via SentryH…
github-actions commentedon Jun 4, 2025
A PR closing this issue has just been released 🚀
This issue was referenced by PR #16473, which was included in the 9.26.0 release.