Event already exists

We’ve been running into issues with Events and it’s starting to drive me nuts. We have 2 Lambda functions that are triggered every x minutes. When I try to deploy that function, I keep on getting the following error: An error occurred: CloudhubDashauthEventsRuleSchedule1 - EVENT_NAME already exists.

Even after removing the Stack, it still throws that error. I verified it manually in the UI after I ran the serverless remove command and the nothing was there (function was completely removed).

This is an excerpt of the configuration:

functions:
  func-name:
    handler: Handler
    events:
      - schedule:
          name: func-name-${self:provider.stage}
          description: 'Function'
          rate: rate(50 minutes)
          enabled: ${opt:enableTrigger, self:provider.triggerEnabled}

I checked the CloudFormation code that the framework generates, but I can’t see any duplicate configurations. I verified the CloudFormation code in the AWS UI and it doesn’t show me an error or anything.

Any advice?

We found today that it happens when you change order of “schedule”-s in serverless.yml (by adding or removing a schedule)

1 Like

Thanks for posting that solution! I swapped two of my schedule functions around and that fixed it for me.