[英]aws lambda - 503 service unavailable when calling 3rd party API using axios
I have a lambda function which is calling 3rd party API using axios, when it calls 3rd party API, it creates a new entry on their database, which is working fine but the lambda function is returning 503 service unavailable I have a lambda function which is calling 3rd party API using axios, when it calls 3rd party API, it creates a new entry on their database, which is working fine but the lambda function is returning 503 service unavailable
Following is my code -以下是我的代码 -
let algcon = {
method: 'post',
url: constants.API_URL,
timeout: 1000 * 7,
headers: {
'Content-Type': 'application/json',
"User-Agent": "axios 0.21.1",
'token': myToken ? JSON.stringify(myToken.access) : ''
},
data: invoiceData,
};
await axios(algcon).then(function (response) {
}).catch(function (error) {
console.log(error) //here it is throwing 503 service unavailable error
});
I have increased lambda execution time but still getting the same error.我增加了 lambda 执行时间,但仍然出现相同的错误。 Please help!!
请帮忙!!
Your code looks fine to me,你的代码对我来说看起来不错,
the default timeout of an API gateway response is 6500 milliseconds
API 网关响应的默认超时为 6500 毫秒
You can update it as -您可以将其更新为 -
Like I did in below screenshot -就像我在下面的屏幕截图中所做的那样 -
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.