Repository navigation
Closed
Description
This is a Bug Report
Description
PR #3125 broke our ability to deploy. The root issue is that we do not have rights to iam:GetUser (and actually don't have users at all) (concretely, we have an explicit deny on "iam:*User*"). This means that the call fails and we cannot deploy.
For bug reports:
- What went wrong?
Issued sls deploy
Error <role>/AWSCodeBuild is not authorized to perform: iam:GetUser on resource: arn:aws:sts::<account-id>:assumed-role/<role>/AWSCodeBuild observed.
- What did you expect should have happened?
Successful deploy
-
What was the config you used?
https://github.com/Nordstrom/hello-retail/blob/initial-formation/retail-stream/serverless.yml -
What stacktrace or error message from your provider did you see?
[Container] 2017/01/27 01:00:49 Deploying Retail Stream in /tmp/src[...]/src/retail-stream
<sls deploy -s ${STAGE}>
[Container] 2017/01/27 01:00:51 Serverless: Packaging service...
[Container] 2017/01/27 01:00:51 Serverless: Uploading CloudFormation file to S3...
[Container] 2017/01/27 01:00:51 Serverless: Uploading service .zip file to S3 (175.58 KB)...
[Container] 2017/01/27 01:00:51 Serverless: Updating Stack...
[Container] 2017/01/27 01:00:52
[Container] 2017/01/27 01:00:52
Serverless Error ---------------------------------------
[Container] 2017/01/27 01:00:52
[Container] 2017/01/27 01:00:52
Stack Trace --------------------------------------------
arn:aws:sts::<account-id>:assumed-role/code-bui
[Container] 2017/01/27 01:00:52
Stack Trace --------------------------------------------
[Container] 2017/01/27 01:00:52 arn:aws:sts::<account-id>:assumed-role/<role>/AWSCodeBuild
[Container] 2017/01/27 01:00:52 o
[Container] 2017/01/27 01:00:52 Get Support --------------------------------------------
[Container] 2017/01/27 01:00:52
[Container] 2017/01/27 01:00:52 Bugs: github.com/serverless/serverless/issues
<role>/AWSCodeBuild is not authorized to perform: iam:GetUser on resource: arn:aws:sts::<account-id>:assumed-role/<role>/AWSCodeBuild
[Container] 2017/01/27 01:00:52 at Response.<anonymous> (/usr/local/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:162:20)
[Container] 2017/01/27 01:00:52 at Request.<anonymous> (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:355:18)
[Container] 2017/01/27 01:00:52 at Request.callListeners (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
[Container] 2017/01/27 01:00:52 at Request.emit (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
[Container] 2017/01/27 01:00:52 at Request.emit (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:668:14)
[Container] 2017/01/27 01:00:52 at Request.transition (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:22:10)
[Container] 2017/01/27 01:00:52 at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:14:12)
[Container] 2017/01/27 01:00:52 at /usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:26:10
[Container] 2017/01/27 01:00:52 at Request.<anonymous> (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:38:9)
[Container] 2017/01/27 01:00:52 at Request.<anonymous> (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:670:12)
[Container] 2017/01/27 01:00:52 at Request.callListeners (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
[Container] 2017/01/27 01:00:52 at Request.emit (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
[Container] 2017/01/27 01:00:52 at Request.emit (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:668:14)
[Container] 2017/01/27 01:00:52 at Request.transition (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:22:10)
[Container] 2017/01/27 01:00:52 at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:14:12)
[Container] 2017/01/27 01:00:52 at /usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:26:10
[Container] 2017/01/27 01:00:52 From previous event:
[Container] 2017/01/27 01:00:52 at /usr/local/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:150:14
[Container] 2017/01/27 01:00:52 at doCall (/usr/local/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:129:9)
[Container] 2017/01/27 01:00:52 at /usr/local/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:140:14
[Container] 2017/01/27 01:00:52 From previous event:
[Container] 2017/01/27 01:00:52 at BbPromise (/usr/local/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:127:38)
[Container] 2017/01/27 01:00:52 at AwsProvider.request (/usr/local/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:143:12)
[Container] 2017/01/27 01:00:52 at AwsProvider.getAccountId (/usr/local/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:230:17)
[Container] 2017/01/27 01:00:52 at /usr/local/lib/node_modules/serverless/lib/plugins/aws/info/getStackInfo.js:48:31
[Container] 2017/01/27 01:00:52 From previous event:
[Container] 2017/01/27 01:00:52 at AwsInfo.getStackInfo (/usr/local/lib/node_modules/serverless/lib/plugins/aws/info/getStackInfo.js:48:6)
[Container] 2017/01/27 01:00:52 From previous event:
[Container] 2017/01/27 01:00:52 at AwsInfo.<anonymous> (/usr/local/lib/node_modules/serverless/lib/plugins/aws/info/index.js:36:14)
[Container] 2017/01/27 01:00:52 From previous event:
[Container] 2017/01/27 01:00:52 at AwsInfo.hooks.deploy:deploy (/usr/local/lib/node_modules/serverless/lib/plugins/aws/info/index.js:30:10)
[Container] 2017/01/27 01:00:52 at /usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:160:50
[Container] 2017/01/27 01:00:52 at processImmediate [as _immediateCallback] (timers.js:383:17)
[Container] 2017/01/27 01:00:52 From previous event:
[Container] 2017/01/27 01:00:52 at PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:160:22)
[Container] 2017/01/27 01:00:52 at Serverless.run (/usr/local/lib/node_modules/serverless/lib/Serverless.js:91:31)
[Container] 2017/01/27 01:00:52 at /usr/local/lib/node_modules/serverless/bin/serverless:21:50
Additional Data
- Serverless Framework Version you're using: Serverless Version: 1.5.1
- Operating System: Ubuntu (AWS CodeBuild "NodeJs 4.3.2" Build)
- Stack Trace: above
- Provider Error messages: above
Activity
erikerikson commentedon Jan 27, 2017
FWIW, we can successfully obtain the Account ID by executing the following:
aws sts get-caller-identity --output text --query 'Account'erikerikson commentedon Jan 27, 2017
To call from nodejs:
http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/STS.html#getCallerIdentity-property
Use STS getCallerIdentity instead of IAM getUser
pmuens commentedon Jan 27, 2017
Hey @erikerikson thank you very much for this detailed description and the fix (will look into it next up).
Glad to have the fix in place before the next release which will prevent many deployments from breaking! 💪 💥
P.S. I'll PR a fix soon which removes the whole arn displaying in the
infoplugin ("Just in case...")pmuens commentedon Jan 27, 2017
Should be resolved because #3152 was merged.
erikerikson commentedon Jan 27, 2017
Thank you so much for jumping on this and getting it through!
pmuens commentedon Jan 28, 2017
Thanks for fixing this right away @erikerikson! 💯 👍