-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
Description
This is a Bug Report
Description
After updating to serverless 1.37 our serverless.yml (almost) silently stopped setting environment to lambdas. The issue ended up being related to default values of variables when including external files.
Here is an example config:
service: my-service
custom:
config: ${file(config/${opt:stage, 'development'}.yml)}
provider:
name: aws
stage: ${self:custom.stage}
environment: ${self:custom.config.environment}
The output of sls print -s production is:
service: my-service
custom:
config:
environment:
IS_PRODUCTION: 'True'
provider:
stage: production
name: aws
Additionally, serverless shows a warning: A valid service attribute to satisfy the declaration 'self:custom.config.environment' could not be found.
If I remove the default value for opt:stage and use the following config, the problem disappears:
sls print -s production
service: my-service
custom:
config:
environment:
IS_PRODUCTION: 'True'
provider:
stage: production
name: aws
environment: <<< ENVIRONMENT IS PRESENT NOW
$ref: '$["custom"]["config"]["environment"]'
The same config (with the default value) works just fine with serverless@1.36.3.
DianaIonita, jlsan92, atz, jeffgraham-hiatus and FoleyTimjlsan92