You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently, I spotted strange behavior which results in wrong environment variables being fetched by the plugin.
I want to highlight that this problem does not occur with Serverless Framework v2.22 installed globally. However, most recent versions since 2.60 suffer from it.
First problem
Locally installed SF does not see prod stage.
$ node_modules/.bin/sls export-env --all -s qa
Serverless: Deprecation warning: Variables resolver reports following resolution errors:
- Cannot resolve variable at "custom.deployment": Cannot load file from outside of a project directory (configure "projectDir" to extend project boundary)
From a next major this will be communicated with a thrown error.
Set "variablesResolutionMode: 20210326" in your service config, to adapt to new behavior now
More Info: https://www.serverless.com/framework/docs/deprecations/#NEW_VARIABLES_RESOLVER
$ node_modules/.bin/sls export-env --all -s prod
Serverless Error ----------------------------------------
Stack with id <reducted>-prod does not exist
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: darwin
Node Version: 14.16.1
Framework Version: 2.64.1 (local)
Plugin Version: 5.5.0
SDK Version: 4.3.0
Components Version: 3.17.1
Serverless: Deprecation warning: Variables resolver reports following resolution errors:
- Cannot resolve variable at "custom.deployment": Cannot load file from outside of a project directory (configure "projectDir" to extend project boundary)
From a next major this will be communicated with a thrown error.
Set "variablesResolutionMode: 20210326" in your service config, to adapt to new behavior now
More Info: https://www.serverless.com/framework/docs/deprecations/#NEW_VARIABLES_RESOLVER
But globally installed SFv2.22 sees prod stage.
$ sls export-env --all -s prod
Serverless: Running "serverless" installed locally (in service node_modules)
Serverless: Deprecation warning: Variables resolver reports following resolution errors:
- Cannot resolve variable at "custom.deployment": Cannot load file from outside of a project directory (configure "projectDir" to extend project boundary),
- Cannot resolve variable at "functions.addPurchasedCredits.environment.eventBusName": AWS profile "${self:custom.deployment.myProfile.${self:custom.myStage}}" doesn't seem to be configured,
- Cannot resolve variable at "functions.addPurchasedCredits.iamRoleStatements.1.Resource.0": AWS profile "${self:custom.deployment.myProfile.${self:custom.myStage}}" doesn't seem to be configured,
- Cannot resolve variable at "functions.storeUtilization.environment.eventBusName": AWS profile "${self:custom.deployment.myProfile.${self:custom.myStage}}" doesn't seem to be configured,
- Cannot resolve variable at "functions.storeUtilization.iamRoleStatements.1.Resource.0": AWS profile "${self:custom.deployment.myProfile.${self:custom.myStage}}" doesn't seem to be configured
From a next major this will be communicated with a thrown error.
Set "variablesResolutionMode: 20210326" in your service config, to adapt to new behavior now
More Info: https://www.serverless.com/framework/docs/deprecations/#NEW_VARIABLES_RESOLVER
Second problem
The plugin does not fetch properly environment variables, mixes them from different stages. This happens regardless of local / global Serverless Framework installation. In my CI/CD I have globally installed SFv2.60 and the same problem exists. This does not happen on SFv2.22.
For example, on SFv2.64.1 (local) sls export-env --all -s qa results in output which is:
Even if this the 1st call to be made, it will still always default to the "dev" environment.
i.e. running serverless export-env --stage test --verbose will always evaluate the "dev" stage, inside the serverless.yml
provider:
name: aws
stage: ${opt:stage,'dev'}
In my case, I only need to run the export-env for my test env, so by changing the default stage in the "stage" property, means that it will always default to the "test" stage:
Hi @arabold,
Recently, I spotted strange behavior which results in wrong environment variables being fetched by the plugin.
I want to highlight that this problem does not occur with Serverless Framework v2.22 installed globally. However, most recent versions since 2.60 suffer from it.
First problem
Locally installed SF does not see
prod
stage.But globally installed SFv2.22 sees
prod
stage.Second problem
The plugin does not fetch properly environment variables, mixes them from different stages. This happens regardless of local / global Serverless Framework installation. In my CI/CD I have globally installed SFv2.60 and the same problem exists. This does not happen on SFv2.22.
For example, on SFv2.64.1 (local)
sls export-env --all -s qa
results in output which is:As you can see, some are from
dev
stage and other fromqa
. All of them should be fromqa
.The text was updated successfully, but these errors were encountered: