Closed
Description
Checkboxes for prior research
- I've gone through Developer Guide and API reference
- I've checked AWS Forums and StackOverflow.
- I've searched for previous similar issues and didn't find any solution.
Describe the bug
Using @aws-sdk/client-elastic-load-balancing-v2 at version 3.299.0, I am receiving the following error:
TypeError: Cannot read properties of undefined (reading 'LoadBalancerArns')
SDK version number
@aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v18.15.0
Reproduction Steps
#!/usr/bin/env node
const { ElasticLoadBalancingV2: ELBv2 } = require('@aws-sdk/client-elastic-load-balancing-v2')
const elbv2 = new ELBv2()
async function main () {
await findLoadBalancer()
}
async function findLoadBalancer () {
const results = await elbv2.describeLoadBalancers()
console.log(results)
}
main().catch((err) => {
console.error(err.stack)
})
Observed Behavior
TypeError: Cannot read properties of undefined (reading 'LoadBalancerArns')
at serializeAws_queryDescribeLoadBalancersInput (/Users/zrice/projects/project/bin/node_modules/@aws-sdk/client-elastic-load-balancing-v2/dist-cjs/protocols/Aws_query.js:2845:15)
at serializeAws_queryDescribeLoadBalancersCommand (/Users/zrice/projects/project/bin/node_modules/@aws-sdk/client-elastic-load-balancing-v2/dist-cjs/protocols/Aws_query.js:211:12)
at serialize (/Users/zrice/projects/project/bin/node_modules/@aws-sdk/client-elastic-load-balancing-v2/dist-cjs/commands/DescribeLoadBalancersCommand.js:39:79)
at /Users/zrice/projects/project/bin/node_modules/@aws-sdk/middleware-serde/dist-cjs/serializerMiddleware.js:12:27
at /Users/zrice/projects/project/bin/node_modules/@aws-sdk/client-elastic-load-balancing-v2/node_modules/@aws-sdk/middleware-endpoint/dist-cjs/endpointMiddleware.js:20:16
at async /Users/zrice/projects/project/bin/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:7:26
at async findLoadBalancer (/Users/zrice/projects/project/bin/lb-test:14:19)
at async main (/Users/zrice/projects/project/bin/lb-test:9:14)
Expected Behavior
I expect the following to be returned:
{
'$metadata': {
httpStatusCode: 200,
requestId: 'abcdefgh-1234-5678-abcd-abcdefgh1234',
extendedRequestId: undefined,
cfId: undefined,
attempts: 1,
totalRetryDelay: 0
},
LoadBalancers: [
{...},
{...}
]
}
Possible Solution
Allow await elbv2.describeLoadBalancers()
to be used without needing to pass {}
In aws-sdk v2 you can do the following without an error.
const results = await elbv2.describeLoadBalancers()
console.log(results)
I would except the same behavior in aws-sdk v3, but in v3, you have to include a {}
const results = await elbv2.describeLoadBalancers({})
console.log(results)
Additional Information/Context
No response