Exclude all files in package configuration do not work for special file name
Bug Report
Description
We have already set the exclude rule in package section, however we still found there is one strange file that still existed in package. This file is the middle file of npm stream-cache package.
Your Environment Information ---------------------------
Operating System: linux
Node Version: 10.16.3
Framework Version: 1.58.0
Plugin Version: 3.2.4
SDK Version: 2.2.1
Components Core Version: 1.1.2
Components CLI Version: 1.4.0
- What did you do? We deploy our source code and using following settings in package section:
package:
exclude:
- "**/*"
include:
- "api/handler.py"
- What happened? Then we found there's a file web/node_modules/stream-cache/..gitignore.un~ always existed in package.
bash-5.0# sls package -s dev -r ap-northeast-1 --fqdn "test.com"
Serverless: Packaging service...
Serverless: Excluding development dependencies...
bash-5.0# unzip .serverless/test.zip
Archive: .serverless/test.zip
inflating: api/handler.py
inflating: web/node_modules/stream-cache/..gitignore.un~
-
What should've happened? The file of web/node_modules/stream-cache/..gitignore.un~ should not existed in package.
-
What's the content of your
serverless.ymlfile?
service: test
frameworkVersion: ">=1.2.0 <2.0.0"
provider:
name: aws
runtime: python3.6
stage: ${opt:stage}
region: ${opt:region}
description: test
memorySize: 128 # lambda function memory
iamRoleStatements:
- Effect: Allow
Action:
- s3:*
- lambda:InvokeFunction
Resource: "*"
package:
exclude:
- "**/*"
include:
- "api/handler.py"
functions:
handler:
handler: api/handler.handler
timeout: 60
events:
- schedule:
rate: cron(0 3 * * ? *)
enabled: true
input:
domain: ${opt:fqdn}
- What's the output you get when you use the
SLS_DEBUG=*environment variable (e.g.SLS_DEBUG=* serverless deploy)
bash-5.0# SLS_DEBUG=* sls package -s dev -r ap-northeast-1 --fqdn "test.com"
Serverless: Load command interactiveCli
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command config:tabcompletion
Serverless: Load command config:tabcompletion:install
Serverless: Load command config:tabcompletion:uninstall
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command generate-event
Serverless: Load command test
Serverless: Load command dashboard
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Invoke aws:package:finalize
Serverless: Invoke aws:common:moveArtifactsToPackage
- Workaround We need to add this file in exclude field manually, then this file is not included in package. However, it looks like the this name could escape from wildcard pattern of serverless.
package:
exclude:
- "web/node_modules/stream-cache/..gitignore.un~"
- "**/*"
include:
- "api/handler.py"
Please kindly let me know if any question.
Is this a case in latest version?
I do not try the latest version again, and I am not sure is this issue happened again in newest version.
@rachsu do you think we can close this report as outdated?
No problem. Thanks for your assistance.