claygregory/serverless-prune-plugin

Suggestion: skip pruning if deployment is skipped

Opened this issue · 0 comments

I came across this log output today:

service-name: Recoverable error occurred (Rate exceeded), sleeping for ~4 seconds. Try 1 of 20
service-name: Recoverable error occurred (Rate exceeded), sleeping for ~7 seconds. Try 1 of 20
service-name: Recoverable error occurred (Rate exceeded), sleeping for ~6 seconds. Try 1 of 20
service-name: ✔ Pruning of functions complete
service-name: No changes to deploy. Deployment skipped. (36s)

The service was not deployed since there were no changes but the pruning still executed and did nothing other than query AWS for the version of all lambda functions in the service and running in to a AWS rate limit.

I think this could be avoided with a check in index.js postDeploy, similar to what Serverless detects and does internally:

if (this.options.noDeploy === true || this.serverless.service.provider.shouldNotDeploy) {
      return BbPromise.resolve();
    }

What do you think?