I want to trigger a lambda by a cron EventBridge event. To do so I’ve added the following configuration to my serverless.ts:
const serverlessConfiguration: Serverless = { ... functions: { myLambda: { handler: 'src/handler.myLambda', events: [{ eventBridge: { schedule: 'cron(0 2 * * ? *)' } }] }}
However, when I run serverless package I get Deprecation warning: AWS EventBridge resources are not being created using native CloudFormation, this is now possible and the use of custom resources is deprecated. Set eventBridge.useCloudFormation: true
as a provider property to use this now.
When I add the eventBridge attribute like this:
const serverlessConfiguration: Serverless = { ... provider: { ... eventBridge: { useCloudFormation: true } } ... }
the compiler complains ‘eventBridge’ does not exist in type ‘Provider’. Please advice how to solve the problem.