arithmetric/awespottr

AuthFailure: AWS was not able to validate the provided access credentials

apl-git opened this issue · 3 comments

Steps to reproduce the bug:

  1. Create a role in IAM section of AWS console.
  2. Create a policy from the JSON document from the home page, attach a policy to a role.
  3. Assign a role to the AWS instance.
  4. Run awespottr on the instance.

Expected results:
awespottr should show the regions and prices (this was working in summer 2018).

Actual results:
awespottr prints access denied error. See the full text it prints below.

[18:52]:apl@adeaseweb::>awespottr c4.xlarge
Checking spot prices for c4.xlarge instance type.
{ AuthFailure: AWS was not able to validate the provided access credentials
at Request.extractError (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/services/ec2.js:50:35)
at Request.callListeners (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
at Request.emit (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request. (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/request.js:38:9)
at Request. (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
message: 'AWS was not able to validate the provided access credentials',
code: 'AuthFailure',
time: 2019-01-16T23:53:05.198Z,
requestId: '3a4648cb-9b1c-4624-8fde-b4174359b09f',
statusCode: 401,
retryable: false,
retryDelay: 24.198964719436013 } 'AuthFailure: AWS was not able to validate the provided access credentials\n at Request.extractError (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/services/ec2.js:50:35)\n at Request.callListeners (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/sequential_executor.js:105:20)\n at Request.emit (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/sequential_executor.js:77:10)\n at Request.emit (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/request.js:683:14)\n at Request.transition (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/request.js:22:10)\n at AcceptorStateMachine.runTo (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/state_machine.js:14:12)\n at /usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/state_machine.js:26:10\n at Request. (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/request.js:38:9)\n at Request. (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/request.js:685:12)\n at Request.callListeners (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/sequential_executor.js:115:18)'
error { AuthFailure: AWS was not able to validate the provided access credentials
at Request.extractError (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/services/ec2.js:50:35)
at Request.callListeners (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
at Request.emit (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request. (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/request.js:38:9)
at Request. (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (/usr/lib/node_modules/awespottr/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
message: 'AWS was not able to validate the provided access credentials',
code: 'AuthFailure',
time: 2019-01-16T23:53:05.198Z,
requestId: '3a4648cb-9b1c-4624-8fde-b4174359b09f',
statusCode: 401,
retryable: false,
retryDelay: 24.198964719436013 }
[18:53]:apl@adeaseweb:
:>

I've noticed this happening in certain regions (AP for instance). I've submitted a patch in #7 to address this.

Actually, I figured out the issue. It was caused by the system clock being off by several minutes. I am closing the issue.

I continue to run into this with the AP region not returning data when all the others will. That patch will address that situation by allowing data from everywhere else to be displayed even when one region errors.