【发布时间】:2018-03-05 14:08:33
【问题描述】:
我在 ec2 实例上托管微服务。 当我们在开发环境中运行它时,一切正常。但是当我在 https (prod) 环境中运行它时。其中一项服务无法访问另一项服务,出现以下错误:
0|auth_mgr | error: Error Authenticating User: Error: connect ETIMEDOUT 52.7.165.49:3001
0|auth_mgr | at Object._errnoException (util.js:1003:13)
0|auth_mgr | at _exceptionWithHostPort (util.js:1024:20)
0|auth_mgr | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1195:14)
当我从本地机器上打邮递员时,它可以工作:
var userURL = configuration.url.user + '/pool/' + userName;
request({
url: userURL,
method: "GET",
json: true,
headers: {
"content-type": "application/json",
}
}, function (error, response, body) {
if (!error && response.statusCode === 200) {
callback(null, body);
}
else {
if (!error) {
var lookupError = new Error("Failed looking up user pool: " + response.body.Error);
callback(lookupError, response);
}
else {
callback(error, response)
}
}
});
【问题讨论】:
-
您是否能够从 Postman 访问 ec2 API,它是否返回与上述相同的错误?我假设您显示的错误来自终端
-
@Stretch0 是的,我可以通过 Postman 从我的本地计算机上点击它,它工作正常。它没有给我上述错误。
标签: javascript node.js amazon-web-services amazon-ec2