Tuesday, 4 April 2017

NPM apac - node amazon, response undefined

Im using npm apac package to call amazon product api but i cant process the response properly as some of the fields are sometimes undefined. Im sure this is due to async of node

function searchAmazon( keywords, responseGroup, senderId, callback){ 
opHelper.execute('ItemSearch', {
'SearchIndex': 'All',
'Keywords': keywords,
'Availability':'Available',
'ResponseGroup': 'ItemAttributes,Images'
 }).then((response) => {
console.log( 'searched!' );

callback( response, senderId );

}).catch((err) => {
  console.error("Something went wrong! ", err);
}); 
}

I've followed the example on apac home page but i get some errors in the callback. What am i missing?



via Pjotr Raskolnikov

No comments:

Post a Comment