代码之家  ›  专栏  ›  技术社区  ›  sandpat

初始化AWS Amplify时出现“InvalidClientTokenID”错误

  •  0
  • sandpat  · 技术社区  · 6 年前

    我试着用

    $ amplify init
    

    在android项目中。不知何故,每次安装失败时,都会出现以下stacktrace:

    在云中初始化项目…创建时出错 cloudformation堆栈根堆栈创建失败init失败{ invalidClientTokenID:请求中包含的安全令牌是 无效。 应请求.extracterror(/usr/local/lib/node-modules/@aws-amplify/cli/node-modules/amplify-provider-awscloudformation/node-modules/aws-sdk/lib/protocol/query.js:47:29) 应请求。调用侦听器(/usr/local/lib/node_modules/@aws amplify/cli/node_modules/amplify provider awscloudformation/node_modules/aws sdk/lib/sequential_executor.js:109:20) 应请求发出(/usr/local/lib/node庘modules/@aws amplify/cli/node庘modules/amplify provider awscloudformation/node庘modules/aws sdk/lib/sequential庘executor.js:81:10) 应请求发出(/usr/local/lib/node庘modules/@aws amplify/cli/node庘modules/amplify provider awscloudformation/node庘modules/aws sdk/lib/request.js:683:14) 应请求转换(/usr/local/lib/node庘modules/@aws amplify/cli/node庘modules/amplify provider awscloudformation/node庘modules/aws sdk/lib/request.js:22:10) 在acceptorstatemachine.runto(/usr/local/lib/node_modules/@aws amplify/cli/node_modules/amplify provider awscloudformation/node_modules/aws sdk/lib/state_machine.js:14:12) at/usr/local/lib/node庘modules/@aws-amplify/cli/node庘modules/amplify-provider-awscloudformation/node庘modules/aws-sdk/lib/state庘machine.js:26:10 应请求。(/usr/local/lib/node庘modules/@aws-amplify/cli/node庘modules/amplify-provider-awscloudformation/node庘modules/aws-sdk/lib/request.js:38:9) 应请求。(/usr/local/lib/node庘modules/@aws-amplify/cli/node庘modules/amplify-provider-awscloudformation/node庘modules/aws-sdk/lib/request.js:685:12) 应请求。调用侦听器(/usr/local/lib/node_modules/@aws amplify/cli/node_modules/amplify provider awscloudformation/node_modules/aws sdk/lib/sequential_executor.js:119:18) 消息:“请求中包含的安全令牌无效。”,
    代码:“InvalidClientTokenID”,时间:2018-10-30T12:24:49.192Z,
    请求ID:'CB4CC85A-DC3E-11E8-AD2E-1DD03551193D',状态代码:403, retryable:false,retrydelay:71.00058281764416}发生错误 创建cloudformation堆栈时

    我尝试删除~/.aws/文件夹中的凭据和配置文件,同时删除aws iam用户并运行

    $ aws configure 
    

    再次执行init命令,但没有任何帮助。不知道怎么了。

    1 回复  |  直到 6 年前
        1
  •  1
  •   sandpat    6 年前

    我用一种奇怪的方式解决了这个问题。可能对别人有帮助。原来,重新安装Amplify cli后,我可以消除错误:

    $ sudo npm install -g @aws-amplify/cli