Javascript axios请求在lambda函数中未收到响应或错误
我有一个脚本,可以在本地工作,但一旦我把它放在Lambda上就不工作了 有两个功能:Javascript axios请求在lambda函数中未收到响应或错误,javascript,node.js,lambda,async-await,axios,Javascript,Node.js,Lambda,Async Await,Axios,我有一个脚本,可以在本地工作,但一旦我把它放在Lambda上就不工作了 有两个功能:playerStatsForAllGamesForPreviousDay和previousDaysGames ... const previousDaysGames = async () => { const full_games = await axios( { method: 'get', url: `https://api-n
playerStatsForAllGamesForPreviousDay
和previousDaysGames
...
const previousDaysGames = async () => {
const full_games = await axios(
{
method: 'get',
url: `https://api-nba-v1.p.rapidapi.com/games/date/${oneDayBefore}`,
headers: {
'x-rapidapi-host': 'api-nba-v1.p.rapidapi.com',
"x-rapidapi-key": 'XXXXXXX'
}
}
).then((res)=>res.data.api.games.map(game=>game.gameId)).catch(err=>console.log('ERROR',err))
return full_games
}
....
const playerStatsForAllGamesForPreviousDay = async () => {
console.log('playerStatsForAllGamesForPreviousDay')
let gameIds = await previousDaysGames()
console.log(gameIds)
let promises = []
gameIds.map( async (v)=> {
promises.push(playerStatsForSpecificGameForPreviousDay(v))
})
return Promise.all(promises)
.then((results) => {
const flattenedResults = [].concat.apply([], results)
return flattenedResults
})
.catch((errors) => {
console.log(errors)
})
}
...
除了这两个函数之外,脚本还有更多的功能,但是脚本将一直运行到playerStatsForAllGamesForPreviousDay
调用previousDaysGames
;一旦发生这种情况,脚本就不会经过这一点,也不会经过const full_games=wait axios
;我可以说它没有超过这一点,因为我已经将console.logs和部署到Lambda并查看了CloudWatch日志
日志中没有返回任何错误信息,这使得调试变得困难,我想找出更多的调试方法,如果有人有解决方案的想法。这有帮助吗?它把我带到了一个我没有想到的方向,最终解决了这个问题。这是一个非常有用的线索,我很感激这有帮助吗?它把我带到了一个我没有想到的方向,最终解决了这个问题。这是一条非常有用的线索,我很感激