Skip to content

Commit

Permalink
fix NodeJS Client is using undefined http agent issue (#4453)
Browse files Browse the repository at this point in the history
* test: add unit test to reproduce the issue

* fix: change the update line order

* chore: code lint fix

* Update .changes/next-release/bugfix-NodeJS-Client-80bdf3e3.json

Co-authored-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com>

---------

Co-authored-by: Ray Wang <>
Co-authored-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com>
  • Loading branch information
pivstone and trivikr committed Jul 7, 2023
1 parent 7e35f37 commit a4b2ea8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/next-release/bugfix-NodeJS-Client-80bdf3e3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "bugfix",
"category": "node",
"description": "use undefined node http agent if explicitly passed by user"
}
3 changes: 2 additions & 1 deletion lib/http/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ AWS.NodeHttpClient = AWS.util.inherit({
path: pathPrefix + httpRequest.path
};

AWS.util.update(options, httpOptions);

if (!httpOptions.agent) {
options.agent = this.getAgent(useSSL, {
keepAlive: process.env[CONNECTION_REUSE_ENV_NAME] === '1' ? true : false
});
}

AWS.util.update(options, httpOptions);
delete options.proxy; // proxy isn't an HTTP option
delete options.timeout; // timeout isn't an HTTP option

Expand Down
16 changes: 16 additions & 0 deletions test/node_http_client.spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a4b2ea8

Please sign in to comment.