(apigateway): RestApi not redeploying correctly
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
When I change a resource path in a RestApi the old path is not removed from the api stage.
The `deploy` option of RestApi should update the stage when a change occur in the api.
### Reproduction Steps
The initial stack:
const api: RestApi = new RestApi(this, 'rest-api', {
deploy: true,
deployOptions: {
stageName: 'test-stage'
}
})
const myResource:IResource = api.root.addResource("myResource", {})
myResource.addMethod("GET",
new Integration({
type:IntegrationType.MOCK,
integrationHttpMethod:'ANY'
})
)
The deployed resources:

The stage:

If I change the path of the resource:
`const myResource:IResource = api.root.addResource("myResourceChanged", {})
`
and redeploy the stack
### What did you expect to happen?
The expect deployed resources:

The expect stage:

### What actually happened?
The new deployed resources:

The new stage:

If I manually redeploy the stage from the console, the /myResource is removed from the stage.
### Environment
- **CDK CLI Version :*1.103.0 (build bc13a66)*
- **Framework Version:**
- **Node.js Version:*v14.13.1*
- **OS :*Windows 10*
- **Language (Version):*TypeScript(3.9.7)*
### Other
---
This is :bug: Bug Report
Contributor guide
Research direction
Start by reproducing the TypeScript RestApi example with deploy enabled and a named stage, then inspect the RestApi deployment behavior when the resource path changes. Done means redeploying the stack removes the old path from the API stage without requiring a manual console redeployment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- api, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100