boto / botocore

The low-level, core functionality of boto3 and the AWS CLI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KeyValueStoreAssociations missing in CloudFront CreateFunction

colask8 opened this issue · comments

Describe the bug

Per AWS Boto3 documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/cloudfront/client/create_function.html
Parameter in FunctionConfig is missing. Looking at the definition the parameter is not listed. Resulting in an Parameter Validation error

   "FunctionConfig":{
      "type":"structure",
      "required":[
        "Comment",
        "Runtime"
      ],
      "members":{
        "Comment":{
          "shape":"string",
          "documentation":"<p>A comment to describe the function.</p>"
        },
        "Runtime":{
          "shape":"FunctionRuntime",
          "documentation":"<p>The function's runtime environment. The only valid value is <code>cloudfront-js-1.0</code>.</p>"
        }
      },
      "documentation":"<p>Contains configuration information about a CloudFront function.</p>"

Expected Behavior

Expected behavior, it should accept

response = client.create_function(
    Name='string',
    FunctionConfig={
        'Comment': 'string',
        'Runtime': 'cloudfront-js-1.0'|'cloudfront-js-2.0',
        'KeyValueStoreAssociations': {
            'Quantity': 123,
            'Items': [
                {
                    'KeyValueStoreARN': 'string'
                },
            ]
        }
    },
    FunctionCode=b'bytes'
)

Current Behavior

ParamaterValidation error:

    raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Unknown parameter in FunctionConfig: "KeyValueStoreAssociations", must be one of: Comment, Runtime

Reproduction Steps

Create function from boto3 cloudfront client

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.34.60

Environment details (OS name and version, etc.)

Mac OS 14.2.1 (23C71), python 3.11

Hi @colask8, thanks for reaching out. I was not able to reproduce this behavior using the sample code. Could you provide debug logs of the behavior? You can get debug logs by adding boto3.set_stream_logger('') to the top of your script, and redacting any sensitive information. Any additional environment details you can provide would also be helpful. Specifically, are you using Lambda in this at all? Thanks!

Hi @RyanFitzSimmonsAK,

Thanks for assistance. After your reply I went to verify the packages in my python venv and found out python3 and python3.11 didnt point to same python site-packages. Issue was one of them had botocore 1.28.x
Managed to upgrade to botocore[crt] and the issue is gone.

Apologies for inconvenience.

KR,
Stojan - Cola

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.