ssh2 timed out while waiting for handshake in nodejs - node.js

I am trying to upload a file using ssh in my nodejs application, while trying, I am getting error as "connection error: timed out while waiting for handshake". gave connection setting as,
....
}).connect({
host: 'hostname without http',
port: 22,
debug: console.log,
readyTimeout: 99999,
username: 'name',
password: 'password'
});
If I upload manually to the server it is working fine with the given hostname, username and password.

Related

Access database on Server with localhost node Project

I have bought a VPS for my website. I have built a small project with vue and node.
In this I used postgresql that is working fine on localhost.
I want to change my database from localhost to the server database where I have installed postgres and made a database and table.
My db.js file looks like this:
const Pool = require('pg').Pool;
const pool = new Pool({
user: "postgres",
password: "root",
database: "todo_database",
host:"45.111.241.15",
port: 5432
});
module.exports = pool;
Then I tried to send form data from the localhost vue page and it gave the following error:
error connecting db Error: connect ECONNREFUSED 45.111.241.15:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '45.111.241.15',
port: 5432
I do not have much knowledge about this and how to solve this.
Can you please guide me what should I do to connect with my server db?
I follow these steps and it worked:
edit your /etc/postgresql/9.1/main/postgresql.conf and change
Connection Settings -
listen_addresses = '*' # what IP address(es) to listen on;
In /etc/postgresql/10/main/pg_hba.conf
IPv4 local connections:
host all all 0.0.0.0/0 md5
Now restart your DBMS
sudo service postgresql restart
Now you can connect with
psql -h hostname(IP) -p 5432 -U postgres

Connection with SQL Server 2014 with node js

I am unable to connect to my SQL Server 2014 from node server.
I get this error:
Failed to connect to 192.168.1.3,2207:2207:1433 - getaddrinfo ENOTFOUND 192.168.1.3,2207:2207'
TCP port also enabled but same issue
By using knex i resolve this problem
connection: {
server : 'IP Address',
user : 'sa',
password : '******',
database : '*****',
options: {
port: 14831
}
}

isSSL false even though I've set tls to True when sending mail

I'm trying to use an external smtp server from my springboot-application (scaffolded by JHipster). I have set the folling in my applocation.yml, and it picks up everything except the SSH settings.
host: send.one.com
port: 465
username: user#name
password: password
protocol: smtp
tls: true
auth: true
from: user#name
When i run the app I can see the following in my log
[DEBUG] com.sun.mail.smtp - useEhlo true, useAuth true
[DEBUG] com.sun.mail.smtp - trying to connect to host "send.one.com", port 465, isSSL false
[DEBUG] com.sun.mail.smtp - EOF: [EOF]
[DEBUG] com.sun.mail.smtp - could not connect to host "send.one.com", port: 465, response: -1
it seems the application is trying to connect without ssl, and it won't connect. What am I doing wrong?
You try to send over TLS. In general the standard port used by TLS is 587 and not 465 which is used for SSL. Try whether it works with that port?

sending mail in cloud9.io

I am running a sails.js project using nodemailer locally which is working well.Nodemailer use Smtp and Gmail's service.Problem is when i transfer my project on cloud9 it is blocking mail.
smtpTransport = nodemailer.createTransport('SMTP', {
host: 'smtp.gmail.com',
port: 25,
service: 'Gmail',
auth: {
user: model.sender,
pass: model.password
}
});
here is configurations and error is:
{ [Error: connect ETIMEDOUT]
code: 'ETIMEDOUT',
errno: 'ETIMEDOUT',
syscall: 'connect',
stage: 'init' }
from different searches i got that c9.io isn't supporting smtp.if it is true then how can i use nodemailer with c9 to send mails to gmail account.
on port 465 it gives this error
{ [AuthError: Invalid login - 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbv2r
534-5.7.14 5eXedgG1jE_vYL7r- o5CxdrMS5XlCbdbloPcENHa08v5fCwuvs7oM9ztAhkUh6RHfRvcBp
534-5.7.14 Qcpg_pdi-2E3Z9m1ipIvu4SZViMJABSDq3XWCMeLzlDfyS3C0JhoY7ldwRxsl3CZ67dvGQ
534-5.7.14
name: 'AuthError',
data: '534-5.7.14 <https://accounts.google.com/ContinueSignIn? sarp=1&scc=1&plt=AKgnsbv2r\r\n534-5.7.14 5eXedgG1jE_vYL7r-o5CxdrMS5XlCbdbloPcENHa08v5fCwuvs7oM9ztAhkUh6RHfRvcBp\r\n534-5.7.14 Qcpg_pdi-2E3Z9m1ipIvu4SZViMJABSDq3XWCMeLzlDfyS3C0JhoY7ldwRxsl3CZ67dvGQ\r\n534-5.7.14 S7PQL4xbl4No8jS_2ZVMnlNO5iYfZ7O9tTe8S1bu3DnkFwjWNNzvLBZ3zK_pzIfMRnH566\r\n534-5.7.14 sEij4Iu9_U6V4g9tCuXH5i87nWYc> Please log in via your web browser and\r\n534-5.7.14 then try again.\r\n534-5.7.14 Learn more at\r\n534 5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 k6sm6950159wia.6 - gsmtp',
stage: 'auth' }
on port 587 it gives this error
{ [Error: 140581811607424:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:795:
] stage: 'init' }
Google Compute Engine does not allow outbound connections on ports 25, 465, and 587 but you can still set up your instances to send mail through ports 587 and 465 using servers provided through partner services, such as SendGrid.
https://cloud.google.com/compute/docs/tutorials/sending-mail
Since Cloud9 workspaces are hosted on GCE, you'll have to use the supported partner services as detailed in the above document.

nodejs - cassandra-client error: All connections are unhealthy

I keep getting this error when I try to retrieve/update data from cassandra using cassandra-client.
{ [Error: All connections are unhealthy.]
connectionInfo:
{ host: 'localhost',
port: 9160,
keyspace: 'keyspace1',
user: undefined,
pass: undefined,
use_bigints: false,
timeout: 4000,
log_time: false,
staleThreshold: 10000 } }
Haven't got a clue as to what this error means.
The error indicates that your client is not able to connect to the specified server on localhost port 9160.
Since this is localhost you can most likely exclude any firewall problems.
What you can do
1. Check if your server is running after all
This should show you one or more processes ( except the grep process you're just executing
ps aux | grep "cassandra"
2. Verify the port
# telnet localhost 9160
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
Bad.. This would indicate that something with your configuration might be wrong. In my case I simply don't have a cassandra server listening to port 9160 ( running at all )
3. Check your logfile
By default casandra writes into the folder /var/log/cassandra/
If anything is wrong with the server, you'll most likely have some more information available in there, might even show a problem related to your nodejs client
4. Try another client for debugging
http://wiki.apache.org/cassandra/GettingStarted#Step_4:_Using_cassandra-cli

Resources