Всегда делайте «try…catch…» при разборе JSON.
request(options, (error, response, body) => {
let data = {}, products = [];
if(error){
// handle the error here
console.log(error);
res.redirect('/fallback');
}
try
{
data = JSON.parse(body);
products = data.productList.filter(product => product.instock);
} catch(exception) {
// handle the exception here
console.log(exception);
res.redirect('/fallback');
}
// everything is OK
res.render('productsList', {
products: products
});
});