serverless: Cannot override aws-profile with empty value after updating from v2.23 to v2.27.1

As explained in #9010, our frontend repo is using provider.profile when deploying from local dev PCs (for convenience) whereas the CI/CD pipeline overrides the profile setting with an empty string so that serverless picks up credentials from environment variables set by Jenkins.

This got broken in v2.24, and it is still broken in v2.27.1. While in v2.24 it complains about sub command not being valid, in v2.27.1 it just won’t override anymore; the provider.profile is always resolved to whatever fallback there is in the yml file (could be some empty string vs null/undefined somewhere?).

serverless.yml
plugins:
  - serverless-s3-sync

provider:
  name: aws
  stage: ${opt:stage, 'dev'}
  region: ${opt:region, 'us-east-1'}
  profile: ${opt:aws-profile, 'devprofile'}
serverless s3sync --stage mystage --aws-profile= output
  Serverless Error ---------------------------------------

  "--aws-profile=" is not a valid sub command. Run "serverless s3sync" to see a more helpful error message for this command.

I installed latest master (2.27.1, commit 551ddd2 and here the validation error is gone; however, the aws-profile is no longer overridden, so my deployment fails later with an error that shows the provider.profile was resolved to the default value from serverless.yml.

  Error: Profile devprofile does not exist
      at Object.addProfileCredentials (K:\SWS\sws-admin\node_modules\serverless\lib\plugins\aws\provider.js:146:15)
      at AwsProvider.getCredentials (K:\SWS\sws-admin\node_modules\serverless\lib\plugins\aws\provider.js:1508:12)
      at AwsProvider.request (K:\SWS\sws-admin\node_modules\serverless\lib\plugins\aws\provider.js:1350:48)

Installed version

Multiple versions, see above.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 21 (20 by maintainers)

Most upvoted comments

@coyoteecd still give us a moment. I’m having a second thoughts, and considering supporting intentional null as value from which we should not fallback. It actually makes sense in many scenarios