fix(gen2-migration): refactor breaks when auth triggers are placed outside of the auth stack in gen2#14786
Merged
iliapolo merged 5 commits intogen2-migrationfrom Apr 16, 2026
Merged
Conversation
refactor breaks for auth triggers placed outside of the auth stack
refactor breaks for auth triggers placed outside of the auth stackrefactor breaks when auth triggers are placed outside of the auth stack in gen2
9pace
approved these changes
Apr 16, 2026
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.
Description of changes
Fixes a
refactorfailure when an auth trigger Lambda lives in a separate stack from the auth stack. When the trigger is co-located in the auth stack, the UserPool references it viaFn::GetAttwithin the same stack — which our resolvers already handled. When the trigger is in a separate stack, CDK instead threads the Lambda ARN into the auth stack as a CloudFormation parameter.resolveTarget()was not running parameter resolution, so that{"Ref": "referencetoamplify...Arn"}survived into the holding stack template as a dangling reference, causing CloudFormation to reject it with "Unresolved resource dependencies."The fix applies
resolveParametersto the Gen2 target template beforeresolveDependencies, consistent with howresolveSource()already works. The reason we didn't see this before in fitness tracker (which has an auth trigger) is because we manually forced the trigger to placed in the auth stack (usingresourceGroupName) to avoid circular dependency issues - but those issues were not actually caused by the auth trigger, so its not needed.Core fix
resolveTarget()inForwardCategoryRefactorernow runsresolveParametersbeforeresolveDependencies, consistent withresolveSource().Migration app cleanup
Removed the
setResourceGroupNameworkaround for the pre-signup trigger fromfitness-tracker/migration/post-generate.ts.Snapshot regeneration
Snapshots updated to reflect the corrected template resolution output.
Issue #, if available
Fixes #14746
Description of how you validated changes
references are resolved in the Gen2 target template before dependency
stripping.
resource group workaround.
Checklist
yarn testpassesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.