报错内容:
{
"message": "getaddrinfo ENOTFOUND sts.aliyuncs.com, POST https://sts.aliyuncs.com -1 (connected: false, keepalive socket: false, socketHandledRequests: 1, socketHandledResponses: 0)\nheaders: {}"
}
环境:本地localhost
后端: koa
代码片段:
const sts = async (ctx) => {
const conf = JSON.parse(fs.readFileSync(path.resolve(__dirname, './config.json')));
let policy;
if (conf.PolicyFile) {
policy = fs.readFileSync(path.resolve(__dirname, conf.PolicyFile)).toString('utf-8');
}
const client = new STS({
accessKeyId: conf.AccessKeyId,
accessKeySecret: conf.AccessKeySecret
});
try {
console.log(conf);
const result = await client.assumeRole(conf.RoleArn, policy, conf.TokenExpireTime);
ctx.set('Access-Control-Allow-Origin', '*');
ctx.set('Access-Control-Allow-METHOD', 'GET');
ctx.body = {
code: 0,
message: '请求sts签名成功',
bucket,
region,
accessKeyId: result.credentials.AccessKeyId,
accessKeySecret: result.credentials.AccessKeySecret,
securityToken: result.credentials.SecurityToken,
expiration: result.credentials.Expiration
};
} catch (e) {
ctx.body = utils.errorHandle(e.message || '');
}
};
程序前几次没有报这个错,可以顺利上传图片,后面就一直报这个错。望各路大神帮忙!
加入圈子https://h5.dingtalk.com/circle/healthCheckin.html?corpId=ding04bb8e24d2ca6d4b7041969b1885fe17&9b576=903b7&cbdbhh=qwertyuiop&origin=1
已查到问题,DNS系統不能正常工作,可以在host添加106.11.61.111 sts.aliyuncs.com
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。