I am trying to upload a file using basic-ftp and this simple script:
import * as ftp from "basic-ftp";
import 'dotenv/config';
doUpload();
async function doUpload() {
const client = new ftp.Client()
client.ftp.verbose = false;
try {
await client.access({
host: `${process.env.HOST}`,
user: `${process.env.USERNAME}`,
password: `${process.env.PASSWORD}`,
secure: true,
secureOptions: {
host: `${process.env.HOST}`,
}
});
console.log(await client.list())
await client.ensureDir("/public_html/json/social-finder");
await client.clearWorkingDir();
await client.uploadFrom("file1.json", "file1.json");
await client.uploadFrom("file2.json", "file2.json");
}
catch (err) {
console.error(err)
}
client.close()
}
I'm getting the error "Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames", error code ERR_TLS_CERT_ALTNAME_INVALID. I use the same credentials and setup with FileZilla with no issues, including over explicit TLS which is why I have secure: true in my access options above.
What does this error mean if I can use this URL to access my server usually without problem via an FTP client? Is there something missing in my setup?