I have a simple problem :).
I am excluding my src and node_modules directory by a global exclude as follows:
package:
individually: true
exclude:
- node_modules/**
- src/**
and then re-include the related files for each function as follows:
functions:
addItem:
handler: src/addItem.handler
name: ${self:provider.stage}-addItem
package:
include:
- src/addItem.js
- node_modules/request
- node_modules/cheerio
however i get the error:
Serverless Error ---------------------------------------
No file matches include / exclude patterns
which is contradicting with the information provided at https://serverless.com/framework/docs/providers/aws/guide/packaging/
I would be very pleased if someone explain to me where my fault is.
Thanks,
TAA
             
            
              
              
              
            
            
           
          
            
            
              Try to use the following glob syntax for directories: directory_name/**. This is mentioned in a note, at the end of the exclude / include examples of the documentation.
In your case, it would be something like this:
functions:
  addItem:
    handler: src/addItem.handler
    name: ${self:provider.stage}-addItem
    package:
      include:
        - src/addItem.js
        - node_modules/request/**
        - node_modules/cheerio/**
Hope it helps!
             
            
              
              
              
            
            
           
          
            
            
              First of all thanks for your reply. Unfortunately I already tried to include /** syntax too. This was a mistake on my part I uploaded the old version of my .yml file. I am having the same error with /** added at the end of the directories.
             
            
              
              
              
            
            
           
          
            
            
              Maybe trying to re-include the directories by whitelisting them via the exclude property would work? Like this:
    package:
      exclude:
        - '!node_modules/request/**'
        - '!node_modules/cheerio/**'
      include:
        - src/addItem.js
             
            
              
              
              
            
            
           
          
            
            
              I also tried this approach too, it is not working. I couldnt find any similar issues both in the forum and github page. Besides this problem deploy is working just fine. When I remove the global excludes all the files are deployed to every function which is not scalable in a bigger project and slows down the functions. I also tried to remove the global excludes and put them in every function, it also failed.