I'm using Node JS (12.13.0) and NPM (6.13.19) with basic-ftp. Everything works fine and I can upload files to the remote FTP (without SSL, my remote FTP doesn't allow this) when I run the code on my development machine from localhost.
The production server is hosted on Digital Ocean (Ubuntu 18.04.3) I have tried to disable the firewall, because I thought this might be the reason to the problem. I used sudo ufw disable and just to make sure it's disabled I check the current status with sudo ufw status which returns Status: inactive.
This is my code
async function uploadImageToFtp(fileName, path) { const client = new ftp.Client() client.ftp.verbose = true try { await client.access({ host: process.env.FTP_HOST, user: process.env.FTP_USER, password: process.env.FTP_PASSWORD, secure: false }) await client.uploadFrom(path, "images/bd/" + fileName) } catch (err) { console.log(err) } client.close()}Response on production
Connected to EXTERNAL_IP_ADDRESS < 220 server ready - login please Loginsecurity: No encryption> USER username < 331 password required> PASS ###Again on localhost everything works and we get past this step and starts uploading the file(s) to the same server and credentials.
After this I never get any response, except for a timeout with Bad Gateway 502 from my request.