amazon-archives / awsmobile-cli

CLI experience for Frontend developers in the JavaScript ecosystem.
Apache License 2.0
142 stars 35 forks source link

Not authorized to perform sts:AssumeRole #96

Closed leonardosul closed 6 years ago

leonardosul commented 6 years ago

I create an awsmobile project locally using awsmobile init. I set some config like awsmobile user-signin enable and then try to awsmobile push.

I get an error stating that AssumeRole has failed: { InternalFailureException: Not authorized to perform sts:AssumeRole (Service: AWSSecurityTokenService; Status Code: 403; Error Code: AccessDenied; Request ID: 726c09fe-3d49-11e8-b0f2-c15d10264856) at Object.extractError (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/protocol/json.js:48:27) at Request.extractError (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/protocol/rest_json.js:52:8) at Request.callListeners (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/sequential_executor.js:105:20) at Request.emit (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/sequential_executor.js:77:10) at Request.emit (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/request.js:683:14) at Request.transition (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/request.js:22:10) at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/state_machine.js:14:12) at /usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/state_machine.js:26:10 at Request.<anonymous> (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/request.js:38:9) at Request.<anonymous> (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/request.js:685:12) message: 'Not authorized to perform sts:AssumeRole (Service: AWSSecurityTokenService; Status Code: 403; Error Code: AccessDenied; Request ID: 726c09fe-3d49-11e8-b0f2-c15d10264856)', code: 'InternalFailureException', time: 2018-04-11T05:30:29.770Z, requestId: '72637ebe-3d49-11e8-9fcf-cd3fe515fd85', statusCode: 500, retryable: true }

I'm using version 1.0.21.

I haven't made any changes to my local setup that should have affected the cli. I have also tried to create a new IAM role with admin permissions but I get the same result.

To offer some context I was following this tutorial when I encountered the issue: https://github.com/richardzcode/Journal-AWS-Amplify-Tutorial

UnleashedMind commented 6 years ago

It might be related to a Mobile Hub update. Please try again see if it's fixed now.

leonardosul commented 6 years ago

Thanks @UnleashedMind , seems to work fine now.

This time after an awsmobile init i got this message: `backend awsmobile project creation error

{ UnauthorizedException: You must first enable Mobile Hub in your account before using the service. Visit the below address to get started: https://console.aws.amazon.com/mobilehub/home?#/activaterole/ at Object.extractError (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/protocol/json.js:48:27) at Request.extractError (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/protocol/rest_json.js:52:8) at Request.callListeners (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/sequential_executor.js:105:20) at Request.emit (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/sequential_executor.js:77:10) at Request.emit (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/request.js:683:14) at Request.transition (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/request.js:22:10) at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/state_machine.js:14:12) at /usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/state_machine.js:26:10 at Request. (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/request.js:38:9) at Request. (/usr/local/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/request.js:685:12) message: 'You must first enable Mobile Hub in your account before using the service.\nVisit the below address to get started:\nhttps://console.aws.amazon.com/mobilehub/home?#/activaterole/', code: 'UnauthorizedException', time: 2018-04-12T07:24:24.808Z, requestId: '8351db7f-3e22-11e8-a652-8dc6e94e05e8', statusCode: 401, retryable: false, retryDelay: 35.90097615642676 }

You must enable Mobile Hub service role before using the awsmobile cli https://console.aws.amazon.com/mobilehub/home?#/activaterole/`

After following the provided link and enabling the role push and pull now works.