I'm trying to add the cloudwatchLog event to my lambda function and am getting an unexpected error. The error message is not very descriptive. Does anyone know what is going on?
Config:
functions:
helloWorld:
handler: dist/handlers/index.helloWorld
events:
- cloudwatchLog:
logGroup: '/aws/lambda/serverless-test-package-4-dev-supWorld'
Error Message:
Serverless Error ---------------------------------------
An error occurred: HelloWorldLogsSubscriptionFilterCloudWatchLog1 -
Resource limit exceeded. (Service: AWSLogs; Status Code: 400; Error
Code: LimitExceededException; Request ID: e30b438c-a654-11e8-837a-7f86cfddec76).
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless
Your Environment Information -----------------------------
OS: linux
Node Version: 8.11.3
Serverless Version: 1.26.1
The problem was that there was already a lambda which had the CloudWatchLog event subscription. AWS limits each CloudWatch Log Group to a maximum of one subscription, as specified by the last row of this documentation.
To solve this you have to remove the already attached subscription from the log group. Just removing the cloudwatchLog
event from lambda and deploying will remove the subscription from the log group. You can then add the cloudwatchLog
event for the required log group and deploy it again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With