aws / aws-sdk

Landing page for the AWS SDKs on GitHub
https://aws.amazon.com/tools/
Other
68 stars 12 forks source link

waitUntilLoadBalancersDeleted never resolves #639

Open cpyle0819 opened 8 months ago

cpyle0819 commented 8 months ago

Checkboxes for prior research

Describe the bug

The waiter, waitUntilLoadBalancersDeleted, returns a promise that never resolves.

SDK version number

"@aws-sdk/client-elastic-load-balancing-v2": "^3.441.0"

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v20.9.0

Reproduction Steps

import {
  ElasticLoadBalancingV2Client,
  waitUntilLoadBalancersDeleted,
} from "@aws-sdk/client-elastic-load-balancing-v2";

await waitUntilLoadBalancersDeleted(
  {
    client: new ElasticLoadBalancingV2Client({}),
  },
  { Names: ["some-fake-name"] }
);

Observed Behavior

The promise from the waiter never resolves.

Expected Behavior

The promise should resolve immediately for non-existent load balancers.

Possible Solution

No response

Additional Information/Context

No response

RanVaknin commented 8 months ago

Hi @cpyle0819 ,

Thanks for the report. I'm able to confirm the issue. The root cause is that the waiter is expecting the exception to be "LoadBalancersNotFound" when in fact the returned exception is "LoadBalancersNotFoundException".

It can be seen here: https://github.com/aws/aws-sdk-js-v3/blob/5aa935c97485df4ec7bf8022e7683c7017a09c24/clients/client-elastic-load-balancing-v2/src/waiters/waitForLoadBalancersDeleted.ts#L36

The SDK is generated with the wrong exception because the ELBV2 API model incorrectly defines its waiter as such: https://github.com/aws/aws-sdk-js-v3/blob/5aa935c97485df4ec7bf8022e7683c7017a09c24/codegen/sdk-codegen/aws-models/elastic-load-balancing-v2.json#L2163

I see that other waiters are also relying on the same exception. Its unclear to me if "LoadBalancersNotFound" is ever returned from the service, but if I had to guess I'd say its probably incorrect as well.

I have created a ticket to the service team to update their C2J file to reflect this change P105020735.

Thanks again, Ran~