Closed piotrekwitkowski closed 3 weeks ago
Hi @piotrekwitkowski - thanks for reaching out.
I'm not able to reproduce with the code below. Can you share reproducible code for the error?
import { CloudFrontClient, DescribeKeyValueStoreCommand } from "@aws-sdk/client-cloudfront";
const client = new CloudFrontClient({region: "us-west-1"});
const input = {
Name: "STRING_VALUE",
};
const command = new DescribeKeyValueStoreCommand(input);
const response = await client.send(command);
Can you also share your Node & SDK version as well?
Hi, updated Node and SDK version above. The issue is not about the good case, when you provide the Name value. It is about the case where I don't provide the value, which is a problem that should be caught way earlier, to improve developer experience.
Thanks for your response. A few things to address here:
string | undefined
vs only string
, it's for forward-compatibility with service models and has been addressed a few times on this repo (https://github.com/aws/aws-sdk-js-v3/issues/5992). Hope it clears things up, let me know if there's any further questions!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.
Checkboxes for prior research
Describe the bug
Many of the required strings in the client's models are incorrectly typed as
string | undefined
, but required in practice. They should be typed asstring
instead.This applies for all commands of the client:
There are 13 occurrences of such bug across these 6 methods.
SDK version number
@aws-sdk/client-cloudfront@3.590.0 @aws-sdk/client-cloudfront-keyvaluestore@3.590.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
Node v18.19.0
Reproduction Steps
In the
@aws-sdk/client-cloudfront
:Similar for the other client, from
@aws-sdk/client-cloudfront-keyvaluestore
Observed Behavior
These types should be
string
s - these fields are required by the API, and there is a runtime error if the value is not set:Expected Behavior
1/ SDK type mentioning
string
only, 2/ my IDE / TypeScript able to detect this behavior at lint/compile time.Possible Solution
Fix autogenerated types
Additional Information/Context
I may be able to fix the bug, please just tell me where to start.