Repository navigation
Closed
Labels
breakingA breaking changebug/designFunctionality design flawcat/packagingdeprecationDeprecation proposal (breaking with next major)help wanted
Description
Hi there!
I am trying to exclude files from a certain function using the exclude functionality on a per function basis. However, it seems like this setting is completely ignored.
Using the serverless config below, my merge deployment contains /lib/linux, which is expected, but the auth package also contains /lib/linux even though it is excluded. Ive tried every variation of glob patterns and ignore/include combos I can think of, but I cannot get this to work.
serverless.yml
service: ...
package:
individually: true
include:
- keys/**
- lib/linux/**
exclude:
- node_modules/aws-sdk/**
custom:
myStage: ${opt:stage, self:provider.stage}
myEnvironment:
ENV:
production: "production"
staging: "staging"
myBuckets:
ENV:
staging: ...
production: ...
provider:
name: aws
runtime: nodejs10.x
functions:
merge:
handler: services/merge/handler.handle
environment:
ENV: ${self:custom.myEnvironment.ENV.${self:custom.myStage}}
events:
- http:
path: /xfdf/merge
method: post
cors: true
auth:
handler: services/auth/handler.handle
package:
exclude:
- node_modules/**
- keys/**
- lib/linux/**
events:
- cloudFront:
eventType: viewer-request
origin:
DomainName: ${self:custom.myBuckets.ENV.${self:custom.myStage}}
S3OriginConfig:
OriginAccessIdentity: ...
behavior:
ForwardedValues:
QueryString: true
Headers:
- 'Access-Control-Request-Headers'
- 'Access-Control-Request-Method'
- 'Origin'
AllowedMethods:
- 'GET'
- 'HEAD'
- 'OPTIONS'I am deploying using sls deploy --stage staging. The output is normal.
Installed version
$ sls --version
Framework Core: 1.78.1
Plugin: 3.7.0
SDK: 2.3.1
Components: 2.34.5
Metadata
Metadata
Assignees
Labels
breakingA breaking changebug/designFunctionality design flawcat/packagingdeprecationDeprecation proposal (breaking with next major)help wanted
Activity
lbittner-pdftron commentedon Aug 18, 2020
Hi,
I managed to get it working by doing
I'm not sure if
excludeis supposed to work or not. If this is expected behaviour, you can close this ticket.Thanks,
Logan
medikoo commentedon Aug 19, 2020
@lbittner-pdftron thanks for report
This is a packaging logic design issue. Firstly global and individual rules for include and exclude are concatanated together. Then first exclude and after that include rules are applied. Hence in your case global
lib/linux/**include shadows individuallib/linux/**exclude rule.I believe right fix for that is to:
includeandexcludewith singlepatternsrules set (better name welcome), then in one list we can setup both include and exclude rules as follows:lib/**will be shadowed by local!lib/**This should be implemented in two phases
includeandexclude) andpatterns(we should crash if both are used), and we show a deprecation notice ifincludeorexcludeis usedincludeandexclude.PR is welcome!
juanjoDiaz commentedon Nov 29, 2020
Any intention of fixing this?
siourdas-vasilis commentedon Dec 22, 2020
Same problem here..
wallacepf commentedon Feb 1, 2021
Same here.
medikoo commentedon Feb 2, 2021
@wallacepf We have nearly finalized PR for that, so stay tuned, we should have fixed that shortly