Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

NetworkingError: Can't set headers after they are sent. #763

@dippi

Description

@dippi

Hi, we intermittently had this issue while uploading a file to S3 using aws-sdk.

NetworkingError: Can't set headers after they are sent.
    at ClientRequest.setHeader (_http_outgoing.js:371:11)
    at Object.requestTrace [as request] (/data/node_modules/@google-cloud/trace-agent/build/src/plugins/plugin-http.js:124:13)
    at Object.request (https.js:206:15)
    at features.constructor.handleRequest (/data/node_modules/aws-sdk/lib/http/node.js:42:23)
    at executeSend (/data/node_modules/aws-sdk/lib/event_listeners.js:304:29)
    at Request.SEND (/data/node_modules/aws-sdk/lib/event_listeners.js:318:9)
    at Request.callListeners (/data/node_modules/aws-sdk/lib/sequential_executor.js:101:18)
    at Request.emit (/data/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/data/node_modules/aws-sdk/lib/request.js:683:14)
    at Request.transition (/data/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/data/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /data/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/data/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/data/node_modules/aws-sdk/lib/request.js:685:12)
    at Request.callListeners (/data/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
    at callNextListener (/data/node_modules/aws-sdk/lib/sequential_executor.js:95:12)
    at /data/node_modules/aws-sdk/lib/event_listeners.js:220:9
    at finish (/data/node_modules/aws-sdk/lib/config.js:320:7)
    at /data/node_modules/aws-sdk/lib/config.js:338:9
    at Credentials.get (/data/node_modules/aws-sdk/lib/credentials.js:126:7)
    at getAsyncCredentials (/data/node_modules/aws-sdk/lib/config.js:332:24)
    at Config.getCredentials (/data/node_modules/aws-sdk/lib/config.js:352:9)
    at Request.SIGN (/data/node_modules/aws-sdk/lib/event_listeners.js:192:22)
    at Request.callListeners (/data/node_modules/aws-sdk/lib/sequential_executor.js:101:18)
    at Request.emit (/data/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/data/node_modules/aws-sdk/lib/request.js:683:14)
    at Request.transition (/data/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/data/node_modules/aws-sdk/lib/state_machine.js:14:12)

The stack points here: https://github.com/GoogleCloudPlatform/cloud-trace-nodejs/blob/master/src/plugins/plugin-http.ts#L147-L148
I have to admit I haven't collected much information at the moment, so tell me if there is something you'd like to know to understand the issue better.
Any idea on what's happening and how to solve it?
Thanks!

( @Macr0s FYI )

Metadata

Metadata

Assignees

Labels

api: cloudtraceIssues related to the googleapis/cloud-trace-nodejs API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions