I'm using the node-postgres client to my AWS Redshift database.
Locally, I'm able to run the following code in node
, getting print statements for ">> connected" and ">>> successful query. jsonResult: ".
However, when I run this code in Amazon Lambda, I don't see any log statements besides "trying to connect...".
console.log("trying to connect...");
var r = pg.connect(conString, function(err, client) {
if(err) {
return console.log('>> could not connect to redshift', err);
}
console.log(">> connected");
client.query('SELECT * FROM my_table', function(err, result) {
if(err) {
return console.log('error running query', err);
}
var jsonResult = JSON.stringify( result );
console.log(">>> successful query. jsonResult: " + jsonResult);
client.end();
return jsonResult;
});
});
I'm confused as to how no print statement, besides ">> trying to connect...," could show up in this code.