Skip to content

Commit 6aa209f

Browse files
authored
fix: function schedule deployment failure issue in the 1.17 update (#3045)
<!-- Thank you for your Pull Request! Please describe the problem this PR fixes and a summary of the changes made. Link to any relevant issues, code snippets, or other PRs. For trivial changes, this template can be ignored in favor of a short description of the changes. --> ## Problem Updating @aws-amplify/backend to version 1.17.0 and deploying causes the following error, resulting in deployment failure. ``` amplify-[redacted]-main-branch-aee3feed3f | 0 | 3:09:47 PM | UPDATE_FAILED | AWS::CloudFormation::Stack | function.NestedStack/function.NestedStackResource (function1351588B) Update of resource type is not permitted. The new template modifies resource type of the following resources: [usagereportfunctionmainlambdaschedule07CE72C09, apikeyexpirationfunctionmainlambdaschedule09DAE100A] ``` The issue was caused by replacing an EventBridge Rule with an EventBridge Scheduler Schedule using the same logical ID, which is not allowed by CloudFormation. <!-- Describe the issue this PR is solving --> **Issue number, if available:** fix #3042 ## Changes <!-- Summarize the changes introduced in this PR. This is a good place to call out critical or potentially problematic parts of the change. --> **Corresponding docs PR, if applicable:** ## Validation <!-- Describe how changes in this PR have been validated. This may include added or updated unit, integration and/or E2E tests, test workflow runs, or manual verification. If manual verification is the only way changes in this PR have been validated, you will need to write some automated tests before this PR is ready to merge. For changes to test infra, or non-functional changes, tests are not always required. Instead, you should call out _why_ you think tests are not required here. If changes affect a GitHub workflow that is not included in the PR checks, include a link to a passing test run of the modified workflow. ---> - Manual Testing 1. Deploy with @aws-amplify/backend 1.16.1 an amplify function with a schedule 2. Upgrade to @aws-amplify/backend with this Pull Request modification 3. Deploy again; deployment will success without error. ## Checklist <!-- These items must be completed before a PR is ready to be merged. Feel free to publish a draft PR before these items are complete. --> - [ ] If this PR includes a functional change to the runtime behavior of the code, I have added or updated automated test coverage for this change. - [ ] If this PR requires a change to the [Project Architecture README](../PROJECT_ARCHITECTURE.md), I have included that update in this PR. - [ ] If this PR requires a docs update, I have linked to that docs PR above. - [ ] If this PR modifies E2E tests, makes changes to resource provisioning, or makes SDK calls, I have run the PR checks with the `run-e2e` label set. _By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license._
1 parent 477139e commit 6aa209f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/fancy-hotels-shake.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@aws-amplify/backend-function': patch
3+
'@aws-amplify/backend': patch
4+
---
5+
6+
fix: function schedule deployment failure issue in the 1.17 update

packages/backend-function/src/factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ class AmplifyFunction
651651

652652
expressions.forEach((expression, index) => {
653653
// Lambda name will be prepended to schedule id, so only using index here for uniqueness
654-
new scheduler.Schedule(functionLambda, `schedule${index}`, {
654+
new scheduler.Schedule(functionLambda, `schedule-${index}`, {
655655
schedule: expression,
656656
target: lambdaTarget,
657657
});

0 commit comments

Comments
 (0)