Trying to `put` but `stat()` callback is returning undefined for both `err` and `stats`
See original GitHub issueI receive an error when the code reaches https://github.com/theophilusx/ssh2-sftp-client/blob/master/src/index.js#L277 because the stats
object is undefined
. I don’t have details about the remote server (yet) which is controlled by a third party, but perhaps you may have some instinct as to why the callback for this.sftp.stat
would return undefined
for both err
and stats
arguments.
- Version of node? ==> v12.18.4
- Version of ssh2-sftp-client? ==> latest
- Platform client is on? ==> N/A
- Platform remote sftp server is on? ==> N/A
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Express, calling then() function second times, return ...
I want to sending data to nats streaming server with publisher function. For that I need a second then then function on mongoose...
Read more >oWaiting metric not showing properly when querying
Statistics are only returned if they have a value. Consider the server-side logic like this: For cases where no conversations meet the criteria ......
Read more >Using the Response Object - AWS SDK for JavaScript
After a service object method has been called, it returns an AWS.Response object by passing it to your callback function. You access the...
Read more >JavaScript Interview Questions & Answers
The slice() method returns the selected elements in an array as a new array object. ... error is encountered, If you try to...
Read more >LLVM Programmer's Manual - Documentation
Introduction¶. This document is meant to highlight some of the important classes and interfaces available in the LLVM source-base. This manual is not ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for doing that, really appreciated.
This was my suspicion.
A couple of versions back, I added a lot of additional error checking to try and provide more informative error messages to the client. Many of the error messages from ssh2/ssh2-streams are not particularly informative and led to user confusion (e.g. error messages such as ‘Failure’).
To do this, I added code to do things like verify remote files exist or don’t exist or remote target is a file or a directory etc. This allowed me to provide better error messages that helped users and based on the drop in basic issues, this seems to have worked.
Unfortunately, this has had two undesirable side effects. Firstly, not all sftp servers are equal and some don’t support stat, realPath and listing. While these servers are in the minority, they do exist. The second problem is that this also has a bit of a hit on performance. The hit on performance is particularly noticeable on slow connections.
So I made the decision to remove all this additional error checking in the next version. At the same time, the ssh2 module is getting a complete re-write (so I’m hoping I might be able to convince the maintainer to add/improve error messages where necessary). The ssh2-streams library is being deprecated and its functionality moved into the main ssh2 module.
So the next version will work with sftp servers like the one you are using. Unfortunately, I have to wait for some of the additional functionality (like streams) to be added to ssh2. The ssh2 author says to use ssh2-streams if you still need stream support, but one of the reasons for the ssh2 re-write is that ssh2-streams does not work correctly with node v14+. It is likely I may need to re-think some of the design and API to work with the new ssh2 and I will need to wait until the new ssh2 reaches production readiness before a new version can be released. If this takes too long, I might have to release an intermediate versions which has removed the additional error checking, but still uses the existing ssh2/ssh2-streams modules (which means no node v14+ support).
I’ve started working on the new versions as the branch version-6 in the git repository. The new version should work with sftp servers like the one your using, but it won’t be production ready for quite some time.
Ok I had a few minutes and went back and opened a connection and at the
sftp>
prompt played around with trying to stat the root directory where I’d been trying to upload files. That server does not supportstat
but supportsdf
and trying that I received this helpful error message:Server does not support statvfs@openssh.com extension
. I suspect this is relevant and there may be guards on the server to prevent reading the filesystem stats?