I recently upgraded Serverless from version 1.63.0 to 2.32.1. My project uses a lambda layer which is configured in a subfolder so it can be packaged separately. The serverless.yml file includes this layer definition:
layers: appsync: path: layers/appsync-layer compatibleRuntimes: - nodejs12.x package: include: - node_modules/**
When I deploy the project now, I get the following error message:
Serverless: Deprecation warning: Support for "package.include" and "package.exclude" will be removed with next major release. Please use "package.patterns" instead More Info: https://www.serverless.com/framework/docs/deprecations/#NEW_PACKAGE_PATTERNS
I know this deprecation message is due to the layer configuration because I do not use package.include or package.exclude anywhere else in the serverless.yml file. I modified the layer configuration as such:
layers: appsync: path: layers/appsync-layer compatibleRuntimes: - nodejs12.x package: patterns: - 'node_modules/**'
However, I then get the following warning message:
Serverless: Configuration warning at 'layers.appsync.package': unrecognized property 'patterns' Serverless: Serverless: Learn more about configuration validation here: http://slss.io/configuration-validation Serverless: Serverless: Deprecation warning: Starting with next major, Serverless will throw on configuration errors by default. Adapt to this behavior now by adding "configValidationMode: error" to service configuration More Info: https://www.serverless.com/framework/docs/deprecations/#CONFIG_VALIDATION_MODE_DEFAULT
I know there are many open issues about packaging lambdas and layers on the Serverless Github repository, including:
- Packing of layers is broken · Issue #8612 · serverless/serverless · GitHub
- Improve packaging of lambdas · Issue #6580 · serverless/serverless · GitHub
Am I seeing a bug that should be reported? I know that for now the original configuration with the
include can be used.