ssh2-sftp-client: put command fails with: Bad path: //some_file.txt must be a regular file

Hi,

As stated in the title, I get an error when I try to upload a file to a remote path. I’m guessing the configuration of the remote server is part of the issue because when connecting to other remote servers, I am able to upload files successfully. Unfortunately, I do not know much about the remote server that is failing aside from the credentials I used to connect, and the path I want to upload to.

Here is a snippet of my code:

async uploadFiles() {
    const configFile = this.dependencies.configFile[this.currentActionIndex];
    const log = this.dependencies.log;

    const localFiles = configFile.local.files;
    const dst = configFile.remote.upload;

    for (let i = 0; i < localFiles.length; i++) {
        let localFile = localFiles[i];
        await sftp.put(localFile, `${dst}/${this.extractLocalFileName(localFile)}`);
        this.archiveFile(localFile);
        log.info(`Successfully uploaded ${localFile}`);
    }
}

The path or in the case of my code, the dst variable is ‘/INBOX/…/INBOX’

Node Version: 12.6.1 ssh2-sftp-client version: 5.0.2 My platform: Windows 10

Any help or information would be greatly appreciated!

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

OK, thanks for the update.

If it does turn out to be something related to the remote server configuration, it would be great to get details i.e. server software, platform, version and what had to be changed. I could at least then add that to the README in case others encounter a similar issue.