aws / aws-sdk

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

@aws-sdk/client-cloudfront ListDistributionsCommand returns incorrect "HttpVersion" value #667

Open Jianru-Lin opened 6 months ago

Jianru-Lin commented 6 months ago

Checkboxes for prior research

Describe the bug

I am working on integrating the Cloudfront service with our internal system.

However, I found that the ListDistributionsCommand returns the incorrect "HttpVersion" value.

It returns "HTTP2and3" instead of "http2and3".

SDK version number

@aws-sdk/client-cloudfront@3.477.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v20.9.0

Reproduction Steps

  1. Log in to the AWS CloudFront dashboard.
  2. Create a new distribution; Make sure to select both HTTP/2 and HTTP/3 in the "Supported HTTP versions" section, then submit to create.
  3. Write a minimal node.js code with @aws-sdk/client-cloudfront to send a ListDistributionsCommand request. Check the response to reproduce the bug.

Observed Behavior

This is what I got from aws server:

{
    "$metadata": {
        "httpStatusCode": 200,
        "requestId": "1a551a4f-8a33-4a57-9186-ed4461621524",
        "attempts": 1,
        "totalRetryDelay": 0
    },
    "DistributionList": {
        "Marker": "",
        "MaxItems": 100,
        "IsTruncated": false,
        "Quantity": 1,
        "Items": [
            {
                "Id": "E39HM9L49VTJZO",
                // ... some fields
                "HttpVersion": "HTTP2and3", // 👈 this is wrong, should be "http2and3"
                // ... some fields
            }
        ]
    }
}

Expected Behavior

The value of the "HttpVersion" field should be "http2and3" instead of "HTTP2and3".

This value is incorrect because it does not align with two things:

Possible Solution

No response

Additional Information/Context

For reference purpose, this is what defined in /node_modules/@aws-sdk/client-cloudfront/dist-types/models/models_0.d.ts:

export declare const HttpVersion: {
    readonly http1_1: "http1.1";
    readonly http2: "http2";
    readonly http2and3: "http2and3";
    readonly http3: "http3";
};
RanVaknin commented 6 months ago

Hi @Jianru-Lin ,

Thanks for reaching out. If you didn't know the AWS SDKs are code generated from the API models defined by each service team. In this case, the Cloudfront team has modeled this enum with all lowercase values as seen in the internal API model that each SDK holds.

I would have to reach out to the Cloudfront service team to either change the enum value or correct the value they return.

Aside from spotting the discrepancy, is there anything here that is blocking you?

Thanks, Ran~

P110186243

Jianru-Lin commented 6 months ago

@RanVaknin Thank you for reporting this bug to Cloudfront service team.

amberkushwaha commented 3 months ago

Add a comment and paste drop markdown is also supported in the file also.