serverless / serverless/serverless

`serverless package` now requires AWS credentials if a layer is present in `serverless.yml`

Open
#8,187 12 comments 4 reactions 1 assignee View on GitHub

@ryan-roemer is already working on this.

Since Sep 4, 2020.

bug/design cat/deployment cat/packaging
Dominant language
JavaScript
Stars
46.9k
Forks
5.7k
Avg merge
10h 7m
Merged PRs (30d)
57

Description

Hi folks!

I'm the author of serverless-jetpack and in upgrading my test fixture suite from serverless@1.67.0 to serverless@1.80.1 (which runs virtually all of the available serverless config variations) I noticed the following issue:

If you are just running serverless package to create artifacts and you have a layer included in serverless.yml configuration there is now a hard requirement to have working AWS credentials available (ServerlessError: AWS provider credentials not found).

I'm assuming that this is not intended as packaging seems like it should be able to be completed without credentials.

For ease of reproduction, I have a minimal repository that can be installed to reproduce the issue at: https://github.com/FormidableLabs/serverless-layers-aws-issue

Hope that helps and thanks for the help!

serverless.yml
service: layers-aws-issue

package:
  excludeDevDependencies: true
  include:
    - "!node_modules/**"
    - "!**/*.lock"

custom:
  region: ${opt:region, env:AWS_REGION, "us-east-1"}
  stage: ${opt:stage, env:STAGE, "sandbox"}

provider:
  name: aws
  runtime: nodejs8.10
  region: ${self:custom.region}
  stage: ${self:custom.stage}

# ISSUE NOTE: If you comment out this entire `layers` section,
# packaging works fine without needing AWS credentials.
layers:
  base:
    path: layer

functions:
  base:
    handler: index.handler
    events: # Use a generic proxy to allow Express app to route.
      - http: ANY /base
      - http: 'ANY /base/{proxy+}'
serverless package output
$ SLS_DEBUG=* serverless package
Serverless: To ensure safe major version upgrades ensure "frameworkVersion" setting in service configuration (recommended setup: "frameworkVersion: ^1.81.1")

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 upgrade
Serverless: Load command uninstall
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command generate-event
Serverless: Load command test
Serverless: Load command dashboard
Serverless: Load command output
Serverless: Load command output:get
Serverless: Load command output:list
Serverless: Load command param
Serverless: Load command param:get
Serverless: Load command param:list
Serverless: Load command studio
Serverless: Load command dev
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: [AWS cloudformation undefined 2.026s 0 retries] describeStacks({ StackName: 'layers-aws-issue-sandbox' })
 
  Serverless Error ---------------------------------------
 
  ServerlessError: AWS provider credentials not found. Learn how to set up AWS provider credentials in our docs here: <http://slss.io/aws-creds-setup>.
      at /Users/rye/scm/fmd/serverless-layers-aws-issue/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:527:29
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              12.18.3
     Framework Version:         1.81.1 (local)
     Plugin Version:            3.8.3
     SDK Version:               2.3.1
     Components Version:        2.34.9

Installed version

Framework Core: 1.81.1 (local)
Plugin: 3.8.3
SDK: 2.3.1
Components: 2.34.9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.