serverless-plugin-simulate icon indicating copy to clipboard operation
serverless-plugin-simulate copied to clipboard

aws keys net being injected with roles

Open javiermanzano opened this issue 7 years ago • 0 comments

I'm trying to use role definitions in sepparate files. For that, I'm using this syntax on serverless.yml

resources:
  Resources:
    getMessageRole: ${file(./handlers/importantMsg/role.yml):getMessageRole}
    getMessagesRole: ${file(./handlers/importantMsg/role.yml):getMessagesRole}

And I assign that role to a handler like this:

getMessages:
    role: getMessagesRole
    handler: handlers/messages.getMessages
    AssumeRolePolicyDocument:
    Version: "2012-10-17"
    Statement:
      - Effect: Allow
        Principal:
          Service:
            - lambda.amazonaws.com
        Action: sts:AssumeRole
    events:
      - http:
          path: messages
          method: get
          cors: true

If I try to run with SLS_DEBUG=* sls simulate apigateway -p 5000 --stage dev, AWS keys are filled with this:

AWS_ACCESS_KEY_ID: 'SOME_ACCESS_KEY_ID',
AWS_SECRET_ACCESS_KEY: 'SOME_SECRET_ACCESS_KEY'

Obviously that does not work when trying to do real requests.

Indeed, when we try to run tests with this command: sls invoke test --path ./test/e2e --stage test, those env variables are not even filled.

Everytime I run my e2e tests I get a Missing Credentials error.

Anyone can help me?

Thanks for your help

javiermanzano avatar Apr 10 '18 15:04 javiermanzano