Unsettled Promises in AWS Lambda from SSM Parameters

Viewed 868

I am using the serverless framework to deploy and program my aws lambda function and since my function is ready for production I need to remove the sensitive keys and decided to use aws systems manager (ssm parameter store) to use these keys in a secure manner, but on deployment, I receive the following error message related to the use of these keys. I thought it might be something related to the Iam Role that I manually associated with the lambda, but I'm not sure what would be off with it.

Error:

Serverless Information ----------------------------------

  ##########################################################################################
  # 47555: 0 of 2 promises have settled
  # 47555: 2 unsettled promises:
  # 47555:   ssm:mg-production-domain~true waited on by: undefined
  # 47555:   ssm:mg-production-api-key~true waited on by: undefined
  # This can result from latent connections but may represent a cyclic variable dependency
  ##########################################################################################

YAML:

provider:
  name: aws
  runtime: nodejs10.x
  stage: dev
  region: us-east-1
  environment:
    MG_PRODUCTION_DOMAIN: ${ssm:mg-production-domain~true}
    MG_PRODUCTION_API_KEY: ${ssm:mg-production-api-key~true}

Here is the Iam Role policy I added to the lambda, but I believe there is probably a better way to do this by adding the Iam Role via the YAML file:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "ssm:DescribeParameters",
            "Resource": "*"
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": "ssm:GetParameters",
            "Resource": "arn:aws:ssm:us-east-1:*account-id*:parameter/*"
        },
        {
            "Sid": "VisualEditor2",
            "Effect": "Allow",
            "Action": "ssm:GetParameter",
            "Resource": "arn:aws:ssm:us-east-1:*account-id*:parameter/*"
        }
    ]
}
0 Answers
Related