node-ftp icon indicating copy to clipboard operation
node-ftp copied to clipboard

FTP Timeout issue from Heroku Server

Open jairamaswamy opened this issue 8 years ago • 1 comments

Hi there,

I am using node FTP in my node Js development to connect our companies FTP network. When I run locally, it seems to be working fine. We are deploying this Node JS development in Heroku Server. We were using Proximo add on to generate static IP from Heroku server So that we can introduce the outbound IP to connect our Companies FTP network. Our Companies Networking team confirmed that the outbound ip is hitting the companies FTP network successfully and they are not blocking the firewall. But from the Heroku server we are getting timeout issue as below.

• Timeout while connecting to server***Error: Timeout while connecting to server • May 06 08:33:51 cronservices app/web.1: at null._onTimeout (/app/node_modules/ftp/lib/connection.js:304:24) • May 06 08:33:51 cronservices app/web.1: at Timer.listOnTimeout (timers.js:119:15)

FYI, this is not even working by connecting public ftp ftp://speedtest.tele2.net/ we were getting the same issue on connecting open public ftp

Here is my sample code which I have tried so far

var Client = require('ftp'); var fs = require('fs'); var later = require('later'); var path = require('path');

var connectionProperties = { host: "XXXXX", user: "XXXXX", password: "XXXXXX", port: 21, //pasvTimeout: 50000, //keepalive: 50000, connTimeout:50000 }; function FtpConnect() { var c = new Client(); c.connect(connectionProperties); c.on('error', function (err) { console.log(connTimeout) console.log("Error in connecting FTP" + connectionProperties.host +"for downloading file: " + err.message + "***"+ err.stack); return; }); console.log("FTP Connected"); c.lastMod('test.xml', function (err, result) { console.log("planning to print ftp file timestamp"); if (result) { var ftpLastModified = result.toString(); console.log("FTP file modified date: " + result.toString()); } if (err) { console.log(err.message); } });

} //var sched = later.parse.recur().every(3).minute(), //t = later.setInterval(FtpConnect, sched); FtpConnect();

Thanks Jai

jairamaswamy avatar May 06 '16 15:05 jairamaswamy

I have a very similar issue that I posted about here: https://stackoverflow.com/questions/58594227/release-job-on-heroku-randomly-stops-sending-files-over-ftp

Did you ever make any progress on solving this issue?

My release job has been working fine - I've done nearly 60 releases with no problems on this FTP push. My script still works fine from my local machine but on Heroku I keep getting a timeout error.

My release script is here.

Roaders avatar Oct 28 '19 16:10 Roaders