Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(@aws-cdk/s3): InventoryConfiguration[].Id exceeds maximum size allowed by the PutBucketInventoryConfiguration API, when NodeId is overly long #27793

Closed
bweigel opened this issue Nov 1, 2023 · 2 comments · Fixed by #27794
Labels
@aws-cdk/aws-s3 Related to Amazon S3 bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Comments

@bweigel
Copy link
Contributor

bweigel commented Nov 1, 2023

Describe the bug

In cases where the node-id of the bucket is quite long, the generated InventoryConfiguration[].Id will be longer than the S3 PutBucketInventoryConfiguration API allows. This will cause the cloudformation deployment to fail:

Service: Amazon S3; Status Code: 400; Error Code: MalformedXML; Request ID: ...; S3 Extended Request ID: ...; Proxy: null), The XML you provided was not well-formed or did not validate against our published schema.

Expected Behavior

The automatically generated id will satisfy the S3 API and the deployment will be successful.

Current Behavior

The deployment fails and Cloudformation errors:

2:09:29 PM | CREATE_FAILED        | AWS::S3::Bucket       | VeryVeryVeryVeryVe...NodeIdName0592D76A
The XML you provided was not well-formed or did not validate against our published schema (Service: Amazon S3; Status Code: 400; Error Code: MalformedXML; Request ID: RKRENTWF25HGT99P; S3 Extended Request ID: CB8ezYmFdgU+KE9ZABh1sVEp4v
U1kd7r3Kdkse/pxrNTQImcbrFoO7ODJlwVsVRDTcwbLZIRLE8=; Proxy: null)

Reproduction Steps

Example to reproduce:

const stack = new cdk.Stack();
  
  const inventoryBucket = new s3.Bucket(stack, 'InventoryBucket');
  new s3.Bucket(stack, 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongNodeIdName', {
    inventories: [
      {
        destination: {
          bucket: inventoryBucket,
        },
      },
    ],
  });

Possible Solution

Truncating the inventory-id to 64 characters.


A workaraound is to set the id manually:

const stack = new cdk.Stack();

const inventoryBucket = new s3.Bucket(stack, 'InventoryBucket');
new s3.Bucket(stack, 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVery&LongNodeIdName', {
  inventories: [
    {
      destination: {
        bucket: inventoryBucket,
      },
      inventoryId: 'a-short-id'
    },
  ],
});

Additional Information/Context

Relevant correspondence with the AWS support

Hello ***,

I hope you are doing well. This is *** again from AWS premium support.

[...]
Our service team has identified that the inventory configuration ID should be limited to 64 characters and can only contain letters, numbers, periods, dashes, and underscores.

Upon investigation, we found that the ID generated in the shared CDK code exceeds the 64-character limit. We are actively working on updating our documentation to ensure that this information is readily available to other customers in the future. We deeply regret that it took some time to identify that the root cause of this issue was simply an extra character in the ID.

[...]

Best regards,
***
Amazon Web Services

CDK CLI Version

2.103.1 (build 3bb19ac)

Framework Version

2.103.1

Node.js Version

v18.17.0

OS

Linux 5.15.133-1-MANJARO #1 SMP PREEMPT Sat Sep 23 10:10:02 UTC 2023 x86_64 GNU/Linux

Language

TypeScript

Language Version

Typescript 5.2.2

Other information

No response

@bweigel bweigel added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 1, 2023
@github-actions github-actions bot added the @aws-cdk/aws-s3 Related to Amazon S3 label Nov 1, 2023
@khushail khushail added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Nov 1, 2023
@khushail
Copy link
Contributor

khushail commented Nov 1, 2023

Hi @bweigel , thanks for reporting this and working on PR.

@khushail khushail added p2 effort/small Small work item – less than a day of effort and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Nov 1, 2023
@mergify mergify bot closed this as completed in #27794 Nov 9, 2023
mergify bot pushed a commit that referenced this issue Nov 9, 2023
…the PutBucketInventoryConfiguration API (#27794)

Truncate the inventory-id to 64 characters, such that it conforms to the  S3 PutBucketInventoryConfiguration API.
Also remove non-allowed characters.

Closes #27793.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy link

github-actions bot commented Nov 9, 2023

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

mikewrighton pushed a commit that referenced this issue Nov 13, 2023
…the PutBucketInventoryConfiguration API (#27794)

Truncate the inventory-id to 64 characters, such that it conforms to the  S3 PutBucketInventoryConfiguration API.
Also remove non-allowed characters.

Closes #27793.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-s3 Related to Amazon S3 bug This issue is a bug. effort/small Small work item – less than a day of effort p2
Projects
None yet
2 participants