Tim-B / grunt-aws-lambda

A grunt plugin to assist in developing functions for AWS Lambda.
MIT License
247 stars 100 forks source link

AWS_PROFILE isn't respected by deploy #114

Open jarwol opened 5 years ago

jarwol commented 5 years ago

I'm using version 0.13.0 of the plugin and Node 10.14.0, and I can't get the deploy to respect either the AWS_PROFILE environment variable or the options.profile argument. My ~/.aws/credentials file is set up to use IAM roles that reference my root credentials:

[identity]
aws_access_key_id = YYYYYYYYY
aws_secret_access_key = xxxxxxxxxxxxxx

[test]
role_arn = arn:aws:iam::123345345345:role/MyRole
source_profile = identity

I've exported AWS_PROFILE=test, and using the AWS CLI directly works fine, but Grunt gives me:

AWS API request failed with undefined - CredentialsError: Missing credentials in config Warning: Check your AWS credentials, region and permissions are correct. Use --force to continue.

When I run with --verbose, here's the detailed output:

Running "lambda_deploy:my-lambda-name" (lambda_deploy) task Verifying property lambda_deploy.my-lambda-name exists in config...OK File: [no files] Verifying property lambda_deploy.my-lambda-name.package exists in config...OK Options: profile="test", RoleArn=null, accessKeyId=null, secretAccessKey=null, credentialsJSON=null, region="us-east-1", timeout=30, memory=null, handler="js/src/index.handler", enableVersioning, aliases="my-lambda-name-qa", enablePackageVersionAlias=false, subnetIds=null, securityGroupIds=null