Getting API Call In Node8.10 In Lambda Results In Promise And Undefined
I have a Lambda function written in Node8.1 in which I'm trying to get an array of objects (photos of servers from the Unsplash API), then write them to DynamoDB. Right now I can't
Solution 1:
This part of your function chain does not return a Promise
object since there is no return
:
.then( photos => {
toJson(photos)
})
Try changing that to
.then( photos => {
return toJson(photos)
})
or even just .then(toJson)
if you're feeling ambitious (:
Otherwise, photos.results
is not defined
Post a Comment for "Getting API Call In Node8.10 In Lambda Results In Promise And Undefined"