Repository navigation
fix: ApiStack default stage must depend on its throttled routes - #5
Merged
Merged
Conversation
Second deploy failure after #4: EventTicketing-dev-Api CREATE_FAILED on the DefaultStage resource — "Unable to find Route by key POST /auth/confirm-signup within the provided RouteSettings". The stage's RouteSettings override referenced routes by literal string key, which CloudFormation validates against routes that already exist — but nothing told CFN the Stage had to wait for those Route resources, so it could be created/updated before them. Fix: build the RouteSettings map from the actual HttpRoute objects returned by addRoutes() as routes are created, and add an explicit defaultStage.node.addDependency() for each throttled route at the same time. Confirmed in the synthesized template: DefaultStage now has an explicit DependsOn covering all 7 throttled routes' Route/Integration/ Permission resources, and RouteSettings keys match 1:1. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Hi @ezekielelvis! 👋
Your private repo does not have access to Sourcery.
Please upgrade to continue using Sourcery ✨
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EventTicketing-dev-Apifailed to create:DefaultStage'sRouteSettingsCFN property override referenced routes by literal string key ('POST /auth/confirm-signup', etc.), which the ApiGatewayV2 Stage handler validates against routes that already exist at creation time. Nothing in the template told CloudFormation the Stage had to wait for those Route resources — a literal string key creates no CDK/CFN dependency edge — so the Stage could (and did) get created before its routes.Fix
RouteSettingsmap from the actualHttpRouteobjects returned byaddRoutes()as each route is created in the loop, and calldefaultStage.node.addDependency()on the throttled ones at the same time, instead of hardcoding the wholeRouteSettingsobject up front before any routes exist.Verification
pnpm run typecheck,pnpm run lint,pnpm run synthall pass.EventTicketing-dev-Apitemplate directly:DefaultStagenow has an explicitDependsOncovering all 7 throttled routes' Route/Integration/Permission resources (21 entries), andRouteSettingskeys match those routes 1:1.Test plan
main, letCIpass, confirmdeploy.ymlcreatesEventTicketing-dev-Apisuccessfully this time (Auth already deploys cleanly per fix: break circular CFN dependency in AuthStack #4)Monitoringanddeploy-frontendthen complete and the site is reachable🤖 Generated with Claude Code