pirumpi / sftp-upload

Allow to upload the content of a folder to a remote server through SFT utilizing pure Javascript.
40 stars 21 forks source link

Error handle is not a Buffer #21

Closed markus-hsk closed 3 years ago

markus-hsk commented 4 years ago

Hey there, tried your package. Getting this error message:

.\node_modules\scp2\node_modules\ssh2-streams\lib\sftp.js:878
    throw new Error('handle is not a Buffer');
    ^

Error: handle is not a Buffer
    at SFTPStream.writeData (.\node_modules\scp2\node_modules\ssh2-streams\lib\sftp.js:878:11)
    at SFTPWrapper.write (.\node_modules\scp2\node_modules\ssh2\lib\SFTPWrapper.js:48:23)
    at .\node_modules\scp2\lib\client.js:216:18
    at FSReqCallback.wrapper [as oncomplete] (fs.js:487:5)

Used this options:

const sftpOptions = {
                host:            SFTP_HOST,
                username:        SFTP_USER,
                path:            dirPath,
                remoteDir:       '/test',
                excludedFolders: [],
                exclude:         ['.zip'],
                privateKey:      readFile(SFTP_KEYFILE),
                passphrase:      SFTP_KEYPW,
                dryRun:          false
            };

There are 5 xml files in the directory dirPath.

package.json:


{
  "dependencies": {
    "@loopback/authentication": "^3.3.3",
    "@loopback/boot": "^1.7.4",
    "@loopback/context": "^1.25.1",
    "@loopback/core": "^1.12.4",
    "@loopback/openapi-v3": "^1.13.0",
    "@loopback/repository": "^1.19.1",
    "@loopback/rest": "^1.26.1",
    "@loopback/rest-explorer": "^1.4.10",
    "@loopback/service-proxy": "^1.3.17",
    "@types/jsonwebtoken": "^8.3.8",
    "@types/passport": "^1.0.2",
    "activedirectory2": "^1.3.0",
    "archiver": "^3.1.1",
    "bcryptjs": "^2.4.3",
    "check-disk-space": "^2.1.0",
    "db-migrate": "^0.11.6",
    "db-migrate-mysql": "^1.1.10",
    "debug": "^4.1.1",
    "dotenv": "^8.2.0",
    "exceljs": "^3.8.1",
    "find-remove": "^2.0.1",
    "isemail": "^3.2.0",
    "jsonwebtoken": "^8.5.1",
    "locutus": "^2.0.11",
    "lodash": "^4.17.15",
    "log4js": "^4.5.1",
    "loopback-connector": "^4.10.1",
    "loopback-connector-mysql": "^5.4.2",
    "loopback-connector-rest": "^3.6.0",
    "mime-types": "^2.1.26",
    "moment": "^2.24.0",
    "moment-business-days": "^1.1.3",
    "multer": "^1.4.2",
    "nodemailer": "^6.4.4",
    "nyc": "^14.1.1",
    "qrcode": "^1.4.4",
    "sftp-upload": "^1.0.2",
    "uuid": "^3.4.0",
    "xml-js": "^1.6.11"
  },
  "devDependencies": {
    "@loopback/build": "^2.1.0",
    "@loopback/eslint-config": "^4.1.5",
    "@loopback/testlab": "^1.10.3",
    "@types/bcryptjs": "2.4.2",
    "@types/debug": "4.1.4",
    "@types/express": "4.17.0",
    "@types/lodash": "4.14.134",
    "@types/node": "^10.17.17",
    "@typescript-eslint/eslint-plugin": "^2.22.0",
    "@typescript-eslint/parser": "^2.22.0",
    "eslint": "^6.8.0",
    "eslint-config-prettier": "^6.10.0",
    "eslint-plugin-eslint-plugin": "^2.2.1",
    "eslint-plugin-mocha": "^6.3.0",
    "typescript": "^3.8.3"
  }
}
hesto2 commented 3 years ago

I'm seeing this error as well

pirumpi commented 3 years ago

Can you provide the step of reproducing this error?

markus-hsk commented 3 years ago

Sorry, i can't help anymore. Had to switch to a different package for my project. This problem is too long ago to figure out what might be the case back then.