AWS::Serverless::Function type supports multiple event sources however it is limited to one event per type. I have the need to trigger multiple scheduled events for the same function with different inputs.
The only way I can make this work is to manually create multiple AWS::Events::Rule and point the target to the function.
The serverless framework supports this use case.
I think I figured out how to do that. Closing.
@patrickli how did you do it? I'm facing the same problem.
@tskinn The Events takes a dictionary, so you can give each Event a different name. This is easier to explain in an example (below). You can intermix different 'Types', just as long as you have different 'Keys' in the Events Dictionary. Does that help?
Events:
Timer1:
Type: Schedule
Properties:
Schedule: rate(5 minutes)
Timer2:
Type: Schedule
Properties:
Schedule: rate(1 hour)
Sorry yeah I just figured out my problem. It actually turned out to be a problem with my inline swagger. It was malformed because of duplicate paths but aws sam wasn't complaining so I didn't catch it. I copied my swagger into the swagger editor and was able to quickly find my mistake.
Thanks for the quick reply though!
Most helpful comment
@tskinn The Events takes a dictionary, so you can give each Event a different name. This is easier to explain in an example (below). You can intermix different 'Types', just as long as you have different 'Keys' in the Events Dictionary. Does that help?