Cannot Read Property Of Undefined After Promise.promisify
let nasPath = ''; return getFamInfo(args.familyID) .then(function (famInfo) { nasPath = //some code involving famInfo here return getSFTPConnection(config.nasSe
Solution 1:
That error means that your sftp
value is undefined
so when you try to pass sftp.fastPut
to the promisify()
method, it generates an error because you're trying to reference undefined.fastPut
which is a TypeError
.
So, the solution is to back up a few steps and figure out why sftp
doesn't have the desired value in it.
Another possibility is that the error is coming from inside the module and it's because the implementation of sftp.fastPut
is referencing this
which it expects to be sftp
. Your method of promisifying is not preserving the value of this
. You can fix that by changing your code to:
const fastPutProm = Promise.promisify(sftp.fastPut, {context: sftp});
Post a Comment for "Cannot Read Property Of Undefined After Promise.promisify"