aws / aws/aws-cdk

(custom-resources): AwsCustomResource has an unnecessary risk of responses being too large

Open
#28,145 0 comments 3 reactions 0 assignees View on GitHub
@aws-cdk/custom-resources bug effort/medium p1
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

Observed in https://github.com/aws/aws-cdk/issues/28108 (temporary fix: https://github.com/aws/aws-cdk/pull/28112)

The `AwsCustomResource` custom resource posts the entire response object to CloudFormation, which can exceed the maximum size of a response object.

The workaround that has been invented previously is to have the user declare using `outputPaths` exactly what paths to include in the response so that we can stay within the maximum size.

This puts a burden on the user that is fully unnecessary: the `AwsCustomResource` can know beforehand exactly which fields are required, because it knows exactly what `resource.getAttString()` calls are being expected of it.

This behavior should be automatic, and not come down to user input (because users will forget, which will lead to the linked issue).

### Expected Behavior

`AwsCustomResource` should determine its fields to respond automatically.

### Current Behavior

The construct library author needs to remember that responses can become too large, and when they add a call to `resource.getAttString()` they have to remember to update `outputPaths` in the custom resource.

### Reproduction Steps

-

### Possible Solution

We should fill the list of `outputPaths` automatically from the calls to `getAttString()`.

The `outputPaths` property should become a single top-level property, and be removed from the `AwsApiCall` structure as well. It doesn't make sense that the values can be different for `CREATE` and `UPDATE`, that's not how CloudFormation works.

### Additional Information/Context

_No response_

### CDK CLI Version

-

### Framework Version

_No response_

### Node.js Version

-

### OS

-

### Language

TypeScript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with AwsCustomResource, AwsApiCall, outputPaths, and getAttString, then review the linked issue 28108 and pull request 28112 for the failure context. Determine how requested attribute paths can be collected automatically and represented as one top-level outputPaths property; done means responses include only the required fields for CloudFormation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.