Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Serverless diff ignores some aspects of the CloudFormation template #12488

Open
dmitry-serkoff opened this issue May 17, 2024 · 1 comment

Comments

@dmitry-serkoff
Copy link

dmitry-serkoff commented May 17, 2024

Issue description

Deploy lambda function with cron event trigger

functionName:
    role: arn:aws:iam::${self:custom.config.accountId}:role/service
    timeout: 900
    reservedConcurrency: 200
    handler: handler.default
    name: function-name
    events:
      - schedule:
          name: event-name
          rate: rate(5 minutes)
          enabled: false

redeploy this function with events - schedule - enabled: true

I used different variations of sls deploy command. I tried sls deploy, sls deploy function --force -u and other combination, but trigger configuration didn't changed it stay disabled.

sls deploy function -f functionName -s pro -u
return

Function configuration did not change, and the update was skipped. If you made changes to the service configuration and expected them to be deployed, it most likely means that they can only be applied with a full service deployment.

Context

I compare cloudformation templates and found a differnce in State.

AWS cloudformation template:

"FunctionEventsRuleSchedule1": {
	"Type": "AWS::Events::Rule",
	"Properties": {
		"ScheduleExpression": "rate(5 minutes)",
		"State": "DISABLED",
		"Name": "function-name",
		"Targets": [
			{
				"InputTransformer": {
					"InputTemplate": "{\"eventTime\":<eventTime>, \"env\":\"live\"}",
					"InputPathsMap": {
						"eventTime": "$.time"
					}
				},
				"Id": "functionSchedule"
			}
		]
	}
},

Genrated cloudformation-template-update-stack.json fragment

"FunctionEventsRuleSchedule1": {
      "Type": "AWS::Events::Rule",
      "Properties": {
        "ScheduleExpression": "rate(5 minutes)",
        "State": "ENABLED",
        "Name": "function-name",
        "Targets": [
          {
            "InputTransformer": {
              "InputTemplate": "{\"eventTime\":<eventTime>, \"env\":\"live\"}",
              "InputPathsMap": {
                "eventTime": "$.time"
              }
            }
          }
        ]
      }
    },
@eahefnawy
Copy link
Member

Are you getting this error message when you run "sls deploy function" only, or do you get it when you run "sls deploy" as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants