# Serverless Deploy Re-including files does not work after a global exclude

**URL:** <https://forum.serverless.com/t/serverless-deploy-re-including-files-does-not-work-after-a-global-exclude/5935>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [September 25, 2018, 7:40pm UTC](https://forum.serverless.com/t/serverless-deploy-re-including-files-does-not-work-after-a-global-exclude/5935 "2018-09-25T19:40:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aakyildiz](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@aakyildiz](https://forum.serverless.com/u/aakyildiz)\
**Post date:** [September 25, 2018, 7:40pm UTC](https://forum.serverless.com/t/serverless-deploy-re-including-files-does-not-work-after-a-global-exclude/5935/1 "2018-09-25T19:40:05Z")

</div>

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/](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

---

<div class="post-metadata">

**Author:** ![teddy-gustiaux](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/teddy-gustiaux/32/2494_2.png) [@teddy-gustiaux](https://forum.serverless.com/u/teddy-gustiaux)\
**Post date:** [September 27, 2018, 12:21pm UTC](https://forum.serverless.com/t/serverless-deploy-re-including-files-does-not-work-after-a-global-exclude/5935/2 "2018-09-27T12:21:12Z")

</div>

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](https://serverless.com/framework/docs/providers/aws/guide/packaging#examples).

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!

---

<div class="post-metadata">

**Author:** ![aakyildiz](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@aakyildiz](https://forum.serverless.com/u/aakyildiz)\
**Post date:** [September 27, 2018, 2:04pm UTC](https://forum.serverless.com/t/serverless-deploy-re-including-files-does-not-work-after-a-global-exclude/5935/3 "2018-09-27T14:04:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![teddy-gustiaux](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/teddy-gustiaux/32/2494_2.png) [@teddy-gustiaux](https://forum.serverless.com/u/teddy-gustiaux)\
**Post date:** [September 27, 2018, 2:34pm UTC](https://forum.serverless.com/t/serverless-deploy-re-including-files-does-not-work-after-a-global-exclude/5935/4 "2018-09-27T14:34:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aakyildiz](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@aakyildiz](https://forum.serverless.com/u/aakyildiz)\
**Post date:** [September 27, 2018, 2:56pm UTC](https://forum.serverless.com/t/serverless-deploy-re-including-files-does-not-work-after-a-global-exclude/5935/5 "2018-09-27T14:56:21Z")

</div>

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.
