henhal / serverless-plugin-layer-manager

Plugin for the Serverless framework that offers improved AWS Lambda layer management
MIT License
12 stars 8 forks source link

Ensure DEFAULT_CONFIG is used even if this.config is null #9

Closed iamdavidmartin closed 3 years ago

iamdavidmartin commented 3 years ago

Hello,

The variable this.config is initialized when the package:initialize hook is called, then this.config is referenced during the deployment phase when transformLayerResources is called.

If the package and deploy phases are broken into two steps, for example with this workflow:

serverless package --stage test --package sls-package-output serverless deploy -v --stage test --package sls-package-output

Then this.config is null when the deployment phase is run and transformLayerResources breaks when trying to destructure the vars on line 97 (https://github.com/henhal/serverless-plugin-layer-manager/blob/accf6e6094711c3c5f2fdbbdb95b74c9e654688f/LayerManagerPlugin.js#L97)

This pull request just grabs the DEFAULT_CONFIG if this.config is null.

henhal commented 3 years ago

Thanks for the PR! 👍