vscode-sftp: SFTP error upload no such file after update VS code 1.56.0
Issue Type: Bug
while upload a file from local to remote, it show an error no such file and connection time out 10000. but the file is uploading without problem, just showing an error. This happen because I am update VS code version to 1.56.0.
Extension version: 1.12.9 VS Code version: Code 1.56.0 (cfa2e218100323074ac1948c885448fdf4de2a7f, 2021-05-04T22:09:06.405Z) OS version: Windows_NT x64 10.0.19041
System Info
| Item | Value |
|---|---|
| CPUs | Intel® Core™ i5-7200U CPU @ 2.50GHz (4 x 2712) |
| GPU Status | 2d_canvas: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on rasterization: enabled skia_renderer: enabled_on video_decode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
| Load (avg) | undefined |
| Memory (System) | 11.87GB (5.66GB free) |
| Process Argv | –crash-reporter-id 1ad20214-094e-4571-829c-44d1a08acd9f |
| Screen Reader | no |
| VM | 0% |
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
pythonvspyt602cf:30294773
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt639:30291489
pythontb:30283811
pythonvspyt551:30291414
vspre833cf:30267465
pythonptprofiler:30281270
vscnewfiletext:30294816
vshan820:30294714
pythondataviewer:30285071
vscus158:30286553
vscgsv2ct:30294353
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 87
- Comments: 122
Nice - thanks @sdir. Guess I could have figured that if I thought about it.
So to sum up all the above as TLDR for others skimming this thread:
Do a search inside
~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.jsforoptions.emitClose = false;Add
options.autoDestroy = false;after both instances.To elaborate on this, I believe @sdir is suggesting to add
options.autoDestroy = false;toSFTP.js(refer to lines 3387-3400), which is a part of the ssh2 package.In the context of
liximomo/vscode-sftp, it looks like this is part of ssh2-streams, and you’d want to update:I can confirm that this also works to resolve the issue when running VS Code
1.56.0.You’ll find the NodeJS release notes here which documents the change in default behaviour of
autoDestroy. It was changed in this commit as part of this pull request. Per the comment changes as part of that commit, streams are now closed when anerrorevent is emitted, unless theautoDestroyoption is set tofalsewhen first creating the stream.Editing the file:
~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.jschange the line 388:if (code === STATUS_CODE.OK) {to:if (code === STATUS_CODE.OK || code === STATUS_CODE.NO_SUCH_FILE) {Reload vscode It is not the most correct option but it works.stream.Writable Change
autoDestroyoption default to true in Nodejs V14. add codeYou have to manually update it. There are two easy ways of doing it :
Method 1) a. download my modded v0.4.11 ssh2-streams module version from HERE ! b. go to $HOME/.vscode/extensions/liximomo.sftp-1.12.9/node_modules. (on Windows replace $HOME with %UserProfile%). c. delete “ssh2-streams” folder. d. extract here the downloaded archive (modded v0.4.11 ssh2-streams version). e. you should now have $HOME/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams (on Windows replace $HOME with %UserProfile%). d. restart Visual Studio Code.
Method 2) a. go to $HOME/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib. (on Windows replace $HOME with %UserProfile%). b. open sftp.js file. c. search for “options.emitClose = false;” d. add “options.autoDestroy = false;” after both instances. e. restart Visual Studio Code.
Yeah this is annoying. And I’m not hoping for an update with 311 issues listed and the last commit 2 years ago… Is this extension abandoned?
Just use my version (v1.13.0) that implement the new ssh2 v1.1.0 version that fix every problem 🙂 https://github.com/Natizyskunk/vscode-sftp/releases
@shivam-geek solution works for me. (Windows 10) in ~.vscode\extensions\liximomo.sftp-1.12.9\package.json change “ssh2”: “^x.x.x” to “ssh2”: “^1.1.0” then run in .vscode\extensions\liximomo.sftp-1.12.9> npm install
Guys, please use 👍🏻 emoji on the comment you want to +1, instead of “+1” or a text such as “same problem” as a comment.
Be careful with it, some times, when you update file, is can come empty. And if update folder, some files can be empty, some files may contain text from other files. I downgraded my VSCode to previous version
For now, you can change protocol from sftp to ftp, and port from 22 to 21. Just until get update 😃
Updating the SSH2 package has fixed the issue for me, just need to change the ssh2 version 1.1.0 in the package.json "extensions/liximomo.sftp-1.12.9/package.json, and run npm install, https://www.npmjs.com/package/ssh2
VSCode was recently bumped to node v14. I looked deeper into other packages (ssh2, ssh2-streams) and it lead me to ssh2-sftp-client package. In the overview it says that the node itself had some changes with streams that causes these errors. Node v15.3 had additional changes (or a rollback) that fixes the issue.
In any way, this extension uses ssh2 and probably that’s where the code should be updated and errors handled to work with node v14. I tried updating ssh2 package on this extension, but it didn’t seem to help either. Most likely we’ll have to wait until VSCode node is bumped to v15.
I’ve made a pull request on ssh2-streams repo to (temporary) fix this error : https://github.com/mscdex/ssh2-streams/pull/174
In the same way, add
options.autoDestroy = false;in theReadStreamfunctionFork it and PR. Maybe author will at least accept it as even if it’s not perfect.
This is Perfect, I worked for me without downgrade
Best solution for today, but how about a year from now?
Just downgrade to VSC 1.55 in my opinion. Best solution to this issue
Well, just now I went to the remote server to have a look. Although it was said that there was an error prompt of no such file, the remote file has been updated, which does not affect the use.
Please please… Release an update!
work for me ,thx!
Guys, it’s most likely because of a regression on streams in the Node version that VSCode uses in 1.56.0
Also this extension is pretty much a wrapper of ssh2 package, so not much can be done here.
It will be very sad to find out that the plugin has been abandoned 😦 I did not find a worthy alternative
@IlanVivanco,
Yes for sure, i’ll try my best to keep it up to date and to fix most of the problems people will come across.
The same problem
Version: 1.56.0 (user setup) Commit: cfa2e218100323074ac1948c885448fdf4de2a7f Date: 2021-05-04T22:09:06.405Z Electron: 12.0.4 Chrome: 89.0.4389.114 Node.js: 14.16.0 V8: 8.9.255.24-electron.0 OS: Windows_NT x64 10.0.19041
it works
@lackneets, As i’ve stated above :
@lighthousebulb Yeah… read @Natizyskunk’s post.
+1
I downgraded my vscode to previous version. ( 1.55.2 ) It works well. And disabled automatic update. I will use this version until this is fixed.
download : https://code.visualstudio.com/updates/v1_55
Have the same Problem 😦
+1
Having the same issue. The extension is reporting error but the file is successfully uploaded to remote server:
liximomo.sftp version v1.12.9
Version: 1.56.0 (user setup) Commit: cfa2e218100323074ac1948c885448fdf4de2a7f Date: 2021-05-04T22:09:06.405Z Electron: 12.0.4 Chrome: 89.0.4389.114 Node.js: 14.16.0 V8: 8.9.255.24-electron.0 OS: Windows_NT x64 10.0.18363
Same problem here. The files have been uploaded successfully. Just ‘set modify time’ seems bugged
Because your version doesn’t work!
I mean the ‘Upload Changed Files’ command doesn’t work.
UNDERSTAND!!!
@Natizyskunk are you planning to maintain the new fork?
For Windows users using WSL (I tested it only with WSL2, but expecting the same results on WSL1):
~/.vscode-server/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib. Not only on the Windows side%UserProfile%/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/libIt seems it’s time to switch to rsync or use https://marketplace.visualstudio.com/items?itemName=mkloubert.vscode-deploy-reloaded
Nice work - was on my to-do list for this weekend!
https://github.com/liximomo/vscode-sftp/issues/919#issuecomment-833347042
Same here!
https://github.com/liximomo/vscode-sftp/issues/919#issuecomment-838586635
Works here too, no more popup error!
This fix seemed to solve the issue with uploading to FTP but downloads are still generating the error. Does anyone know if there’s perhaps another instance of this code that needs adjusting in the same way for downloads/sync ations?
Thx! It’s work.
Thanks! The problem is solved.
options.autoClosedefault false butautoDestroynot change. Maybe a bug for ssh-stream library.Thanks! It’s now working perfectly!
Good solutions! It`s not a bug is feature
Thanks! But there are other failures and I’m not willing to downgrade my vscode. Since this extension seems not maintained any more, I’m trying some alternatives right now the ‘ftp-sync’(https://github.com/lukasz-wronski/vscode-ftp-sync) I will update more info later
It sucks… I haven’t found any ok alternatives
You say that, but a lot of other people who say that also never donated to the owner of this repo. If I had to guess, they probably abandoned it because of all the issues people kept posting that were entirely connection/configuration related. That’d be exhausting work to do for free.
+1
+1
+1
+1 @liximomo
Thanks for your remind, this issue is annoying…