Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js aws的Claudiajs hello word示例中未加载凭证_Node.js_Amazon Web Services_Aws Lambda_Claudiajs - Fatal编程技术网

Node.js aws的Claudiajs hello word示例中未加载凭证

Node.js aws的Claudiajs hello word示例中未加载凭证,node.js,amazon-web-services,aws-lambda,claudiajs,Node.js,Amazon Web Services,Aws Lambda,Claudiajs,我尝试使用aws,因此首先我从claudiajs github下载LOLAD,然后在我的aws上使用这些AWSLambdaFullAccess创建一个用户,IAMFullAccess和AmazonAPIGatewayAdministrator然后配置.aws/credentials文件和awscli并将配置文件名从默认更改为claudia,现在我的凭据如下所示: [claudia] aws_access_key_id = xxxxxxxxx aws_secret_access_key = xxx

我尝试使用
aws
,因此首先我从claudiajs github下载LOLAD,然后在我的aws上使用这些
AWSLambdaFullAccess
创建一个用户,
IAMFullAccess
AmazonAPIGatewayAdministrator
然后配置
.aws/credentials
文件和
awscli
并将配置文件名从默认更改为claudia,现在我的凭据如下所示:

[claudia]
aws_access_key_id = xxxxxxxxx
aws_secret_access_key = xxxxxx
之后,根据教程,我运行
npm I
,然后运行
npm start
。脚本如下:

 "scripts": {
    "start": "claudia create --name hello-world --region us-east-1 --handler main.handler",
    "test": "claudia test-lambda",
    "deploy": "claudia update"
},
但是在
npm启动后
我得到以下错误:

npm start

> hello-world@1.0.0 start /home/interact/Try/hello-world
> claudia create --name hello-world --region us-east-1 --handler 
main.handler

initialising IAM role   iam.createRole  RoleName=hello-world-executor
{ Error: connect EHOSTUNREACH 169.254.169.254:80
at Object._errnoException (util.js:992:11)
at _exceptionWithHostPort (util.js:1014:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)
 message: 'Missing credentials in config',
 code: 'CredentialsError',
 errno: 'EHOSTUNREACH',
 syscall: 'connect',
 address: '169.254.169.254',
 port: 80,
 time: 2018-06-13T07:50:47.292Z,
 originalError: 
   { message: 'Could not load credentials from any providers',
 code: 'CredentialsError',
 errno: 'EHOSTUNREACH',
 syscall: 'connect',
 address: '169.254.169.254',
 port: 80,
 time: 2018-06-13T07:50:47.292Z,
 originalError: 
  { code: 'EHOSTUNREACH',
    errno: 'EHOSTUNREACH',
    syscall: 'connect',
    address: '169.254.169.254',
    port: 80,
    message: 'connect EHOSTUNREACH 169.254.169.254:80' } } }
 npm ERR! code ELIFECYCLE
 npm ERR! errno 1
 npm ERR! hello-world@1.0.0 start: `claudia create --name hello-world --region us-east-1 --handler main.handler`
 npm ERR! Exit status 1
 npm ERR! 
 npm ERR! Failed at the hello-world@1.0.0 start script.
 npm ERR! This is probably not a problem with npm. There is likely 
 additional logging output above.

 npm ERR! A complete log of this run can be found in:
 npm ERR!     /home/interact/.npm/_logs/2018-06-13T07_50_47_317Z-
 debug.log
信息是:

  enter code here`message: 'Could not load credentials from any providers'
我在旧金山和网上搜索,但没有找到能解决我问题的东西


我的节点版本是
v8.11.3
,npm版本是
5.6.0

您可以使用两种方法轻松解决问题

1.通过更改.aws/credentials文件。将[claudia]重命名为[default]

 [default]
    aws_access_key_id = xxxxxxxxx
    aws_secret_access_key = xxxxxxxxx
2.设置AWS_PROFILE环境变量

AWS_PROFILE=deployment claudia <options>

您可以使用两种方法轻松解决您的问题

1.通过更改.aws/credentials文件。将[claudia]重命名为[default]

 [default]
    aws_access_key_id = xxxxxxxxx
    aws_secret_access_key = xxxxxxxxx
2.设置AWS_PROFILE环境变量

AWS_PROFILE=deployment claudia <options>
您可以将AWS_PROFILE=PROFILE_name添加到package.json文件中。这将仅为该命令设置配置文件。如果您有多个具有不同帐户的项目,这将非常有用

例如:

"scripts": {
    "start": "AWS_PROFILE=claudia claudia create --name hello-world --region us-east-1 --handler main.handler",
    "test": "AWS_PROFILE=claudia claudia test-lambda",
    "deploy": "AWS_PROFILE=claudia claudia update"
},
您可以将AWS_PROFILE=PROFILE_name添加到package.json文件中。这将仅为该命令设置配置文件。如果您有多个具有不同帐户的项目,这将非常有用

例如:

"scripts": {
    "start": "AWS_PROFILE=claudia claudia create --name hello-world --region us-east-1 --handler main.handler",
    "test": "AWS_PROFILE=claudia claudia test-lambda",
    "deploy": "AWS_PROFILE=claudia claudia update"
},