If you create and deploy an API handler, and then update the "name" of the handler and re-deploy, you will get a 409 conflict due to a "duplicate route" - this is due to the API route in API gateway already existing, and us not being able to switch for a new lambda function with an UPDATE. Cloudformation is attempting to do a CREATE / DELETE of the "old" route integration (which is unchanged, just with a new lambda target).
Faceteer should be using a Cloudformation "Logical ID" based on the API route, not based on the handler definition's name, since for an API handler its unique identifier is its route in the API.
Steps to reproduce:
- Create a service with an api handler
- Deploy it
- change the "name" in the API handler definition
- Redeploy
- Receive the conflict error as seen below:
❌ ExampleService-ayoung failed: Error: The stack named ExampleService-ayoung failed to deploy: UPDATE_ROLLBACK_COMPLETE: Route with key GET /users/{userId} already exists for this API (Service: AmazonApiGatewayV2; Status Code: 409; Error Code: ConflictException; Request ID: 90afc02e-a7b6-4440-9613-1846397bc1d6; Proxy: null)
at prepareAndExecuteChangeSet (/Users/ayoung/projects/faceteer-deploy-issue/stack/node_modules/aws-cdk/lib/api/deploy-stack.ts:385:13)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at CdkToolkit.deploy (/Users/ayoung/projects/faceteer-deploy-issue/stack/node_modules/aws-cdk/lib/cdk-toolkit.ts:209:24)
at initCommandLine (/Users/ayoung/projects/faceteer-deploy-issue/stack/node_modules/aws-cdk/lib/cli.ts:341:12)
The stack named ExampleService-ayoung failed to deploy: UPDATE_ROLLBACK_COMPLETE: Route with key GET /users/{userId} already exists for this API (Service: AmazonApiGatewayV2; Status Code: 409; Error Code: ConflictException; Request ID: 90afc02e-a7b6-4440-9613-1846397bc1d6; Proxy: null)
expected outcome:
The API gateway route integration is updated to use our newly named lambda function instead of the existing one.
If you create and deploy an API handler, and then update the "name" of the handler and re-deploy, you will get a 409 conflict due to a "duplicate route" - this is due to the API route in API gateway already existing, and us not being able to switch for a new lambda function with an UPDATE. Cloudformation is attempting to do a CREATE / DELETE of the "old" route integration (which is unchanged, just with a new lambda target).
Faceteer should be using a Cloudformation "Logical ID" based on the API route, not based on the handler definition's name, since for an API handler its unique identifier is its route in the API.
Steps to reproduce:
expected outcome:
The API gateway route integration is updated to use our newly named lambda function instead of the existing one.