fix(cli-internal): handle ResourceNotFoundException in fetchFunctionSchedule#14891
Open
adrianjoshua-strutt wants to merge 2 commits into
Open
fix(cli-internal): handle ResourceNotFoundException in fetchFunctionSchedule#14891adrianjoshua-strutt wants to merge 2 commits into
adrianjoshua-strutt wants to merge 2 commits into
Conversation
2acec73 to
a81d064
Compare
soberm
previously approved these changes
May 19, 2026
sarayev
previously approved these changes
May 19, 2026
…chedule When a Lambda function has no CloudWatch Events rule (non-scheduled functions), the DescribeRuleCommand API throws ResourceNotFoundException. This crashed the entire gen2-migration generate command. Wrap the DescribeRuleCommand call in a try-catch that specifically catches ResourceNotFoundException and returns undefined (no schedule), matching the existing pattern for GetPolicyCommand. Add 7 unit tests covering all fetchFunctionSchedule scenarios. Closes #14883 --- Prompt: Fix issue #14883 — ResourceNotFoundException in fetchFunctionSchedule when function has no CloudWatch Events rule.
a81d064 to
a73dea9
Compare
sarayev
approved these changes
May 22, 2026
|
@adrianjoshua-strutt Are you able to provide an ETA for when this will be merged in and released? |
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
Fixes #14883.
When a Lambda function has no CloudWatch Events rule (i.e., it is not a scheduled function), the
DescribeRuleCommandAPI throwsResourceNotFoundException. Previously, this call was not wrapped in error handling, causing the entireamplify gen2-migration generatecommand to crash.Fix
Wrap the
DescribeRuleCommandcall in a targeted try-catch that catches onlyResourceNotFoundExceptionand returnsundefined(no schedule found). This matches the existing error-handling pattern already used forGetPolicyCommandin the same method. Non-ResourceNotFoundExceptionerrors (permissions, network) still propagate.Testing
aws-fetcher.test.tswith 7 test cases covering:GetPolicyCommandthrowsResourceNotFoundException→ returnsundefinedDescribeRuleCommandthrowsResourceNotFoundException→ returnsundefined(the bug scenario)ResourceNotFoundExceptionerrors propagate from both API callsundefinedPolicyfield → returnsundefined