【发布时间】:2023-03-30 22:24:02
【问题描述】:
我正在使用 Node JS 并尝试从 AWS 调用 Lambda 函数。 我收到错误:无法满足请求 状态:403
var opts = {
host: 'myhost.amazonaws.com',
region: 'us-east-1',
service: 'execute-api',
path: '/mypath',
method: 'POST',
headers:{
'Content-Type': 'application/json'
}
};
var req = http.request(opts, function(res){
console.log('Status: ' + res.statusCode);
console.log('Headers: ' + JSON.stringify(res.headers));
res.setEncoding('utf8');
res.on('data', function (body){
console.log('Body: ' + body);
});
});
req.on('error',function(e){
console.log('problem with request: '+ e.message);
});
req.end();
我不知道我的语法是否错误。
谢谢
【问题讨论】:
标签: javascript node.js http-post aws-lambda