【发布时间】:2018-10-10 17:26:29
【问题描述】:
我正在尝试使用 aws4 包通过 Javascript 调用私有 Amazon API,但无法正常工作。我可以使用 Postman 成功拨打电话,但我试图让它与代码一起使用,但我失败了。
这是邮递员截图:
下面是试图复制它的代码:
request(aws4.sign({
service: 'execute-api',
region: 'us-east-1',
method: 'POST',
url: 'https://test.amazonAPI.com/test/doThing',
body: load
},
{
accessKeyId: tempCreds.Credentials.AccessKeyId,
secretAccessKey: tempCreds.Credentials.SecretAccessKey,
sessionToken: tempCreds.Credentials.SessionToken
}))
我目前遇到的错误:
Error: getaddrinfo ENOTFOUND execute-api.us-east-1.amazonaws.com execute-api.us-east-1.amazonaws.com:443
at errnoException (dns.js:53:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:95:26)
【问题讨论】:
-
aws4 模块在这方面似乎有点死板。目前尚不清楚(粗略一瞥)它是否具有使用 API 网关 URL 所需的灵活性。
标签: node.js amazon-web-services aws-sdk-js