Serverless: Fix cloudwatchLog event with the case that facing a resource limit exceeded

Created on 6 Apr 2017  路  3Comments  路  Source: serverless/serverless

When using cloudwatchLog event, the deployment will fail with an error that a resource limit exceeded if you replace the logGroup name of one function with the logGroup name of another function in your serverless.yml file and run serverless deploy

This is caused by the fact that CloudFormation tries to attach the new subscription filter before detaching the old one. CloudWatch Logs only support one subscription fitlter per log group as you can read in the documentation about CloudWatch Logs Limits.

We should fix it in upcoming release.

cc @pmuens

bug help wanted

Most helpful comment

Correct!

@horike37 Thanks for opening this one so that we don't forget about it 馃憤

All 3 comments

Correct!

@horike37 Thanks for opening this one so that we don't forget about it 馃憤

The deployment will fail with same error if change the order of the cloudwatchLog groups list when one lambda has been set multiple cloudwatchLog groups.
I test some of the cases, those tow are succeed:

  • when add new cloudwatchLog group(s) at the end of the events list.
  • when delete cloudwatchLog group(s) from the bottom of the events list.

and those are failed:

  • when add new cloudwatchLog group(s) at the middle of the events list.
  • when delete cloudwatchLog group(s) from the middle of the events list.
  • when delete cloudwatchLog group(s) from the top of the events list.

I was trying to debug this issue to see if I could help with a first contribution here and on my tests, I realized that this is not a problem on serverless, but on the CloudFormation itself, I confirmed at after trying to submit a dummy stack adding a log group and a subscription filter, and then after I just changed the key of the subscription filter for something else, the result is the same: CF tries to add it the new one before deleting the existent, therefore everything fails.

Was this page helpful?
0 / 5 - 0 ratings