serverless-plugin-typescript: ServerlessError: No file matches include / exclude patterns when using Layers
Im experiencing No FIle Matches include / exclude patterns when using the new AWS Lambda layers
here is the last part of the logs
serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless Error ----------------------------------------
ServerlessError: No file matches include / exclude patterns
at /Users/glen/_code/ts-ooono-backend/node_modules/serverless/lib/plugins/package/lib/packageService.js:263:13
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async /Users/glen/_code/ts-ooono-backend/node_modules/serverless/lib/plugins/package/lib/packageService.js:91:9
at async Promise.all (index 2)
at async Package.packageService (/Users/glen/_code/ts-ooono-backend/node_modules/serverless/lib/plugins/package/lib/packageService.js:95:5)
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: darwin
Node Version: 16.0.0
Framework Version: 2.47.0 (local)
Plugin Version: 5.4.0
SDK Version: 4.2.3
Components Version: 3.12.0
and this is my layers and plugins
##
## Package settings
##
package:
excludeDevDependencies: true
individually: true
patterns:
- '!node_modules'
- '!layers'
##
## Serverless plugins
## TODO: figure out how to have serverless-plugin-typescript in and still deploy as it doesn't build without it
plugins:
- serverless-plugin-typescript
- serverless-offline
##
## Layers
##
layers:
NodeModules:
path: layers
# name: NodeModules
name: ${sls:stage}-NodeModules
compatibleRuntimes:
- nodejs14.x
package:
patterns:
- '**/**'
description: ---
retain: false # Delete layers once a new one of same name is uploaded
##
## FUNCTIONS
##
functions:
# GET /hello
hello:
handler: ./src/functions/helloworld/index.handler
events: # The events that trigger this function
- http:
path: ts-ooonoBackend/helloworld
method: get
layers:
- { Ref: NodeModulesLambdaLayer }
package:
patterns:
- 'src/functions/helloworld/**'
goodbye:
handler: ./src/functions/goodbye/index.handler
events: # The events that trigger this function
- http:
path: ts-ooonoBackend/goodbye
method: post
layers:
- { Ref: NodeModulesLambdaLayer }
package:
patterns:
- 'src/functions/goodbye/**'
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 18 (5 by maintainers)
Commits related to this issue
- Fix #240 No file matches include / exclude patterns when using Layers — committed to harigel/serverless-plugin-typescript by harigel 4 months ago
I can also confirm it works by using serverless-jetpack
After doing research as part of https://github.com/serverless/serverless/issues/9873 I’ve realised that layers are generally not supported by this plugin so this issue should still be open.
The general problem here lies in the fact that when packaging files for layers,
layer.pathproperty is used as a prefix https://github.com/serverless/serverless/blob/f096440440dfb2339b4fd1ae1ecbca3b59fb4805/lib/plugins/package/lib/packageService.js#L272 however, the logic in the plugin changes theserviceDirto point to.builddirectory, which means that in most scenarios nothing will be available underserviceDir/<layer.path>.I just ran into this and feel like it the commit needs to be reverted. I’m not sure exactly what case allows it to succeed. Is it checking for patterns: include because that is deprecated in serverless v3.
We’ve also been hit by this problem, any update?
@raiseandfall great thanks for pointing. I’ve reached out to author of the PR to eventually update it so it’s in sync with master