# Packaging layers using exclude/include patterns displays deprecation warning

**URL:** <https://forum.serverless.com/t/packaging-layers-using-exclude-include-patterns-displays-deprecation-warning/14613>\
**Category:** Serverless Framework\
**Tags:** lambda\
**Created:** [April 2, 2021, 3:46pm UTC](https://forum.serverless.com/t/packaging-layers-using-exclude-include-patterns-displays-deprecation-warning/14613 "2021-04-02T15:46:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pflugs30](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/pflugs30/32/4255_2.png) [@pflugs30](https://forum.serverless.com/u/pflugs30)\
**Post date:** [April 2, 2021, 3:46pm UTC](https://forum.serverless.com/t/packaging-layers-using-exclude-include-patterns-displays-deprecation-warning/14613/1 "2021-04-02T15:46:35Z")

</div>

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:

```auto
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:

```auto
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:

```auto
layers:
  appsync:
    path: layers/appsync-layer
    compatibleRuntimes:
      - nodejs12.x
    package:
      patterns:
        - 'node_modules/**'

```

However, I then get the following warning message:

```auto
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](https://github.com/serverless/serverless/issues/8612)
- [Improve packaging of lambdas · Issue #6580 · serverless/serverless · GitHub](https://github.com/serverless/serverless/issues/6580)

Am I seeing a bug that should be reported? I know that for now the original configuration with the `include` can be used.
