aws / aws/aws-cdk

(amplify-alpha): Removing `customResponseHeaders` property does not remove the headers from the app

Open
#31,783 8 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-amplify bug effort/small p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

Creating an app with the `customResponseHeaders` property, and then removing the property does not remove the custom headers from the app.

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Version

_No response_

### Expected Behavior

Removing the `customResponseHeaders` property from the App construct should delete it from the Amplify app in the dashboard.

### Current Behavior

The custom headers stay in their previous configuration.

### Reproduction Steps

Create an example Amplify app with the `customResponseHeaders` property:
```typescript
new amplify.App(this, 'App', {
customResponseHeaders: [
{
pattern: '**',
headers: {
Test: 'test',
},
},
],
});
```

Then remove the `customResponseHeaders` property, observe that the headers are still in the Amplify dashboard.

### Possible Solution

Omitting `CustomHeaders` in CloudFormation does not remove the headers from the app, instead we could explicitly set it to an empty string if the `customResponseHeaders` property is not provided, similar to how we currently handle the `basicAuth` property.

### Additional Information/Context

_No response_

### CDK CLI Version

2.162.1 (build 10aa526)

### Framework Version

2.162.1-alpha.0

### Node.js Version

v22.9.0

### OS

macOS 14.7 (23H124)

### Language

TypeScript

### Language Version

TypeScript 5.6.3

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing how the Amplify App construct handles the customResponseHeaders property during CloudFormation synthesis, then compare it with the existing basicAuth handling. Reproduce the configuration change described in the issue and verify that removing the property clears the headers from the Amplify dashboard.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.