I am not able to connect to the redshift database using Node. I am using Node JS version 14.15.1
.
Is there any issue related to this version?
The following code, I have tried in my local machine,
redshift.js
file
var Redshift = require('node-redshift');
var client = {
user: 'user',
database: 'db',
password: 'password',
port: port,
host: 'hostname',
};
var redshiftClient = new Redshift(client, {rawConnection:true});
module.exports = redshiftClient;
The following is the code to get the values from database,
index.js
file
var redshiftClient = require('./redshift.js');
console.log('Before Connection');
redshiftClient.connect(function(err){
console.log('After Connection');
if(err) throw err;
else{
redshiftClient.query('SELECT * FROM "customer"', {raw: true}, function(err, data){
if(err) throw err;
else{
console.log(data);
redshiftClient.close();
}
});
}
});
If I run this code not getting the error and even this line is also not executed console.log('After Connection');