gpt4 book ai didi

javascript - 如何解决网络故障 net::ERR_NAME_NOT_RESOLVED

转载 作者:行者123 更新时间:2023-11-29 19:15:18 33 4
gpt4 key购买 nike

enter image description here我正在向 AWS 发出 Get 请求。通过浏览器(Javascript)获取存储桶列表。我收到以下错误:

Failed to load resource: net::ERR_NAME_NOT_RESOLVED. When I leave region blank, I get following errors. please see the screen shot above for errors i m getting.

这是我的代码:

<!DOCTYPE html>
<html>
<head>

<script src="https://sdk.amazonaws.com/js/aws-sdk-2.2.41.min.js"></script>

</head>
<body>

<div id="status"></div>
<ul id="objects"></ul>
</body>

<script type="text/javascript">
AWS.config.update({accessKeyId: 'key', secretAccessKey: 'GwP/secretkey/XkoAd89kGs'});
// Configure your region
AWS.config.region = 'US Standard';

var bucket = new AWS.S3({params: {Bucket: 'rentonclick'}});
bucket.listObjects(function (err, data) {
if (err) {
console.log('error',err);
} else {
document.getElementById('status').innerHTML =
'Loaded ' + data.Contents.length + ' items from S3';
for (var i = 0; i < data.Contents.length; i++) {
document.getElementById('objects').innerHTML +=
'<li>' + data.Contents[i].Key + '</li>';
}
}
});

</script>

</html>

我也分享了plunker - https://plnkr.co/edit/uw9j9tpfvJ4cRqjbF7nC?p=preview

最佳答案

您的 Amazon AWS 区域似乎无效。

请在您的 Amazon AWS 控制面板中查找您所在的地区。它应该看起来像这样。

AWS.config.region = 'us-east-1';

祝你好运。

关于javascript - 如何解决网络故障 net::ERR_NAME_NOT_RESOLVED,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35828409/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com