-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AWS.NodeHttpClient use undefined httpAgent instead of default one #4452
Comments
Hi @pivstone , Thanks for the feedback and the PR, on a first glance it looks good. Thanks, |
What is the scenario where you pass |
We have an internal library dynamodb client for all our AWS Lambda, something like this. type BaseOptions = {
maxRetries?: number;
timeoutMs?: number;
httpsAgent?: httpsAgent;
};
function buildOption(options: BaseOptions) {
return {
apiVersion: '2012-10-08',
convertEmptyValues: true,
maxRetries: options.maxRetries ?? 3,
httpOptions: {
agent: options.httpsAgent ?? undefined,
timeout: options.timeoutMs ?? 3000,
},
};
}
new AWS.DynamoDB.DocumentClient(buildOption(options)); we added the |
PR merged. Closing. |
Describe the bug
when a user pass agent: undefined to a client (us DynamoDB as example).
AWS.NodeHttpClient set a default agent in here.
aws-sdk-js/lib/http/node.js
Lines 35 to 39 in ffc003b
but the in the next line
options.agent
is updated toundefined
by this line.aws-sdk-js/lib/http/node.js
Line 41 in ffc003b
Because the httpOptions.agent is undefined.
Expected Behavior
The http agent shouldn't be undefined.
Current Behavior
The http agent is undefined.
Reproduction Steps
as the description
Possible Solution
should be executed before assign the default http agent instance.
A suggest fix: #4453
Additional Information/Context
No response
SDK version used
2.1374.0
Environment details (OS name and version, etc.)
Lambda/NodeJs 16
The text was updated successfully, but these errors were encountered: