1

I'm trying to push uploaded images to KeyCDN via FTP protocol in my expressjs API. When I try to push the images locally, everything is working fine. I can push properly, and the links are also working fine.

However, the API hosted on Google Cloud VM logs the push as success, but is only pushing ~80B file.

I have attached the code responsible for pushing the image file to KeyCDN.

const client = new FTP();
client.on('ready', () => {
client.put(`${process.env.UPLOAD_PATH}/${filename}`, `${filename}`, (err) => {
    if (err) {
        console.log(err, `${process.env.UPLOAD_PATH}/${filename}`);
            throw new ValidationError('Unable to upload image data.', filename);
        }
        client.end();
        console.log('Successfully pushed the image file to keyCDN.');
    });
});
client.connect({
    host: process.env.KEYCDN_HOST,
    port: process.env.KEYCDN_PORT,
    user: process.env.KEYCDN_USER,
    password: process.env.KEYCDN_PWD,
    secure: true,
});
Pit
  • 736
  • 3
  • 17
  • Please could you tell me if you already try with secure disabled, just for testing purposes. As well as with SFTP instead of FTP. Were you able to see any network code error ? It will help a lot. There is a [Troubleshooting Guide on KeyCDN](https://www.keycdn.com/support/cdn-troubleshooting-guide) It may be worth to contact with KeyCDN support. Have you opened egress [firewall rules on FTP](https://stackoverflow.com/questions/63964361/set-up-ftp-in-google-cloud-platform). Check if it needs an egress [Firewall](https://cloud.google.com/compute/docs/reference/rest/v1/firewalls) rule. – Pit Jun 22 '21 at 13:45

0 Answers0