liximomo / vscode-sftp

Super fast sftp/ftp extension for VS Code
MIT License
1.51k stars 265 forks source link

SFTP error upload no such file after update VS code 1.56.0 #919

Closed Andika7 closed 3 years ago

Andika7 commented 3 years ago

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(R) Core(TM) 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 ```
Farer commented 3 years ago

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

PolarAir commented 3 years ago

Editing the file: ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js change 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.

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

satiromarra commented 3 years ago

Editing the file:

~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js

change 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.

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

I haven't found alternatives that work or that remain maintained either. Most cases are extensions that have been outdated for quite some time. And in other cases, like "ftp-simple", haven't made it work.

shynekomaid commented 3 years ago

Good solutions! It`s not a bug is feature

mpalencia commented 3 years ago

I solved mine by downgrading:

https://code.visualstudio.com/updates/v1_55

Still works well on version 1.55

necmettin commented 3 years ago

Should we reach maintainers? Two days, and no updates from the creators/ maintainers?

dxma commented 3 years ago

+1

necmettin commented 3 years ago

Should we reach maintainers? Two days, and no updates from the creators/ maintainers?

I tweeted to liximomo, let's wait for his action.

marcopa84 commented 3 years ago

me toooo

SimonaCinti commented 3 years ago

Same problem here after the last VS Code Update

necmettin commented 3 years ago

+1

Guys, please use 👍🏻 emoji on the comment you want to +1, instead of "+1" or a text such as "same problem" as a comment.

PolarAir commented 3 years ago

Should we reach maintainers? Two days, and no updates from the creators/ maintainers?

I tweeted to liximomo, let's wait for his action.

last commit was 1.5yrs ago I doubt whether he would respond..

ghost commented 3 years ago

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.

SmallOyster commented 3 years ago

Editing the file: ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js change 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.

thx !!!! same problem in VSCode 1.56.0

soudblox commented 3 years ago

i have another error: bad descriptor, that's it

soudblox commented 3 years ago

also, where is the .vscode folder located at?

edit: found it

soudblox commented 3 years ago

downgrading works for me so...

lawrencejohnson commented 3 years ago

Editing the file: ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js change 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.

Fork it and PR. Maybe author will at least accept it as even if it's not perfect.

zLevii commented 3 years ago

Just downgrade to VSC 1.55 in my opinion. Best solution to this issue

lawrencejohnson commented 3 years ago

Just downgrade to VSC 1.55 in my opinion. Best solution to this issue

Best solution for today, but how about a year from now?

mrjcgoodwin commented 3 years ago

Same issue. And whilst upload works regardless - download/sync don't seem to work.

soudblox commented 3 years ago

Is there any alternatives for now? Because for now downgrading works... but in the future updates will be needed....

wildcn commented 3 years ago

Editing the file: ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js change 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.

work for me ,thx!

loslch commented 3 years ago

Editing the file: ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js change 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.

Thank you!

sdir commented 3 years ago

stream.Writable Change autoDestroy option default to true in Nodejs V14. add code

function WriteStream(sftp, path, options) {
  if (options === undefined)
    options = {};
  else if (typeof options === 'string')
    options = { encoding: options };
  else if (options === null || typeof options !== 'object')
    throw new TypeError('"options" argument must be a string or an object');
  else
    options = Object.create(options);

  // For backwards compat do not emit close on destroy.
  options.emitClose = false;
  options.autoDestroy = false;

  WritableStream.call(this, options);
kenairock commented 3 years ago

stream.Writable Change autoDestroy option default to true in Nodejs V14. add code

function WriteStream(sftp, path, options) {
  if (options === undefined)
    options = {};
  else if (typeof options === 'string')
    options = { encoding: options };
  else if (options === null || typeof options !== 'object')
    throw new TypeError('"options" argument must be a string or an object');
  else
    options = Object.create(options);

  // For backwards compat do not emit close on destroy.
  options.emitClose = false;
  options.autoDestroy = false;

  WritableStream.call(this, options);

Thanks!

ludovic-lambert commented 3 years ago

Same issue for me.

phuze commented 3 years ago

stream.Writable Change autoDestroy option default to true in Nodejs V14. add code

function WriteStream(sftp, path, options) {
  if (options === undefined)
    options = {};
  else if (typeof options === 'string')
    options = { encoding: options };
  else if (options === null || typeof options !== 'object')
    throw new TypeError('"options" argument must be a string or an object');
  else
    options = Object.create(options);

  // For backwards compat do not emit close on destroy.
  options.emitClose = false;
  options.autoDestroy = false;

  WritableStream.call(this, options);

To elaborate on this, I believe @sdir is suggesting to add options.autoDestroy = false; to SFTP.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:

~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js

I can confirm that this also works to resolve the issue when running VS Code 1.56.0.

image

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 an error event is emitted, unless the autoDestroy option is set to false when first creating the stream.

PolarAir commented 3 years ago

stream.Writable Change autoDestroy option default to true in Nodejs V14. add code

function WriteStream(sftp, path, options) {
  if (options === undefined)
    options = {};
  else if (typeof options === 'string')
    options = { encoding: options };
  else if (options === null || typeof options !== 'object')
    throw new TypeError('"options" argument must be a string or an object');
  else
    options = Object.create(options);

  // For backwards compat do not emit close on destroy.
  options.emitClose = false;
  options.autoDestroy = false;

  WritableStream.call(this, options);

To elaborate on this, I believe @sdir is suggesting to add options.autoDestroy = false; to SFTP.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:

~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js

I can confirm that this also works to resolve the issue when running VS Code 1.56.0.

image

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 an error event is emitted, unless the autoDestroy option is set to false when first creating the stream.

Thanks! It's now working perfectly!

DesistDaydream commented 3 years ago

stream.Writable Change autoDestroy option default to true in Nodejs V14. add code

function WriteStream(sftp, path, options) {
  if (options === undefined)
    options = {};
  else if (typeof options === 'string')
    options = { encoding: options };
  else if (options === null || typeof options !== 'object')
    throw new TypeError('"options" argument must be a string or an object');
  else
    options = Object.create(options);

  // For backwards compat do not emit close on destroy.
  options.emitClose = false;
  options.autoDestroy = false;

  WritableStream.call(this, options);

To elaborate on this, I believe @sdir is suggesting to add options.autoDestroy = false; to SFTP.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:

~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js

I can confirm that this also works to resolve the issue when running VS Code 1.56.0.

image

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 an error event is emitted, unless the autoDestroy option is set to false when first creating the stream.

Thanks! It's now working perfectly!

At the same time, the following problems are also solved

When I use the Upload Folder directives to upload a folder, some files will fail to upload. This situation did not exist before VSCode was updated.

Mickeywaugh commented 3 years ago

stream.Writable Change autoDestroy option default to true in Nodejs V14. add code

function WriteStream(sftp, path, options) {
  if (options === undefined)
    options = {};
  else if (typeof options === 'string')
    options = { encoding: options };
  else if (options === null || typeof options !== 'object')
    throw new TypeError('"options" argument must be a string or an object');
  else
    options = Object.create(options);

  // For backwards compat do not emit close on destroy.
  options.emitClose = false;
  options.autoDestroy = false;

  WritableStream.call(this, options);

To elaborate on this, I believe @sdir is suggesting to add options.autoDestroy = false; to SFTP.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:

~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js

I can confirm that this also works to resolve the issue when running VS Code 1.56.0. image 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 an error event is emitted, unless the autoDestroy option is set to false when first creating the stream.

Thanks! It's now working perfectly!

At the same time, the following problems are also solved

When I use the Upload Folder directives to upload a folder, some files will fail to upload. This situation did not exist before VSCode was updated.

This workaround works indeed. But I think should update code somewhere in this extension (vscode-sftp),may be set default options for calling the function WriteStream() in sftp.js.

sdir commented 3 years ago

stream.Writable Change autoDestroy option default to true in Nodejs V14. add code

function WriteStream(sftp, path, options) {
  if (options === undefined)
    options = {};
  else if (typeof options === 'string')
    options = { encoding: options };
  else if (options === null || typeof options !== 'object')
    throw new TypeError('"options" argument must be a string or an object');
  else
    options = Object.create(options);

  // For backwards compat do not emit close on destroy.
  options.emitClose = false;
  options.autoDestroy = false;

  WritableStream.call(this, options);

To elaborate on this, I believe @sdir is suggesting to add options.autoDestroy = false; to SFTP.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:

~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js

I can confirm that this also works to resolve the issue when running VS Code 1.56.0. image 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 an error event is emitted, unless the autoDestroy option is set to false when first creating the stream.

Thanks! It's now working perfectly! At the same time, the following problems are also solved

When I use the Upload Folder directives to upload a folder, some files will fail to upload. This situation did not exist before VSCode was updated.

This workaround works indeed. But I think should update code somewhere in this extension (vscode-sftp),may be set default options for calling the function WriteStream() in sftp.js.

options.autoClose default false but autoDestroy not change. Maybe a bug for ssh-stream library.

WCX1024979076 commented 3 years ago

Editing the file: ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js change 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.

Thanks! The problem is solved.

looput commented 3 years ago

Editing the file: ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js change 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.

Thanks! The problem is solved.

Thx! It's work.

aplstroedel commented 3 years ago

Editing the file: ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js change 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.

Thanks! The problem is solved.

Thx! It's work.

Works!! But old files will also be synced again...

mrjcgoodwin commented 3 years ago

stream.Writable Change autoDestroy option default to true in Nodejs V14. add code

function WriteStream(sftp, path, options) {
  if (options === undefined)
    options = {};
  else if (typeof options === 'string')
    options = { encoding: options };
  else if (options === null || typeof options !== 'object')
    throw new TypeError('"options" argument must be a string or an object');
  else
    options = Object.create(options);

  // For backwards compat do not emit close on destroy.
  options.emitClose = false;
  options.autoDestroy = false;

  WritableStream.call(this, options);

To elaborate on this, I believe @sdir is suggesting to add options.autoDestroy = false; to SFTP.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:

~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js

I can confirm that this also works to resolve the issue when running VS Code 1.56.0. image 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 an error event is emitted, unless the autoDestroy option is set to false when first creating the stream.

Thanks! It's now working perfectly! At the same time, the following problems are also solved

When I use the Upload Folder directives to upload a folder, some files will fail to upload. This situation did not exist before VSCode was updated.

This workaround works indeed. But I think should update code somewhere in this extension (vscode-sftp),may be set default options for calling the function WriteStream() in sftp.js.

options.autoClose default false but autoDestroy not change. Maybe a bug for ssh-stream library.

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?

sdir commented 3 years ago

stream.Writable Change autoDestroy option default to true in Nodejs V14. add code

function WriteStream(sftp, path, options) {
  if (options === undefined)
    options = {};
  else if (typeof options === 'string')
    options = { encoding: options };
  else if (options === null || typeof options !== 'object')
    throw new TypeError('"options" argument must be a string or an object');
  else
    options = Object.create(options);

  // For backwards compat do not emit close on destroy.
  options.emitClose = false;
  options.autoDestroy = false;

  WritableStream.call(this, options);

To elaborate on this, I believe @sdir is suggesting to add options.autoDestroy = false; to SFTP.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:

~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js

I can confirm that this also works to resolve the issue when running VS Code 1.56.0. image 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 an error event is emitted, unless the autoDestroy option is set to false when first creating the stream.

Thanks! It's now working perfectly! At the same time, the following problems are also solved

When I use the Upload Folder directives to upload a folder, some files will fail to upload. This situation did not exist before VSCode was updated.

This workaround works indeed. But I think should update code somewhere in this extension (vscode-sftp),may be set default options for calling the function WriteStream() in sftp.js.

options.autoClose default false but autoDestroy not change. Maybe a bug for ssh-stream library.

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?

In the same way, add options.autoDestroy = false; in the ReadStream function

mrjcgoodwin commented 3 years ago

In the same way, add options.autoDestroy = false; in the ReadStream function

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:

  1. Do a search inside ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js for options.emitClose = false;

  2. Add options.autoDestroy = false; after both instances.

austre commented 3 years ago

https://github.com/liximomo/vscode-sftp/issues/919#issuecomment-833347042

Same here! File upload well with 1 popup error!

Same here!

https://github.com/liximomo/vscode-sftp/issues/919#issuecomment-838586635

In the same way, add options.autoDestroy = false; in the ReadStream function

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:

  1. Do a search inside ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js for options.emitClose = false;
  2. Add options.autoDestroy = false; after both instances.

Works here too, no more popup error!

ScorpioT1000 commented 3 years ago

it also corrupts files when uploading folder

pearlboy commented 3 years ago

In the same way, add options.autoDestroy = false; in the ReadStream function

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:

  1. Do a search inside ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js for options.emitClose = false;
  2. Add options.autoDestroy = false; after both instances.

This is Perfect, I worked for me without downgrade

gfernandez-me commented 3 years ago

In the same way, add options.autoDestroy = false; in the ReadStream function

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:

  1. Do a search inside ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js for options.emitClose = false;
  2. Add options.autoDestroy = false; after both instances.

superb, thank you!

this is the only one that will work for any case.

also thanks @sdir

Machou commented 3 years ago

if (code === STATUS_CODE.OK || code === STATUS_CODE.NO_SUCH_FILE) {

Work for me :P VSC 1.56.1

Natizyskunk commented 3 years ago

I've made a pull request on ssh2-streams repo to (temporary) fix this error : https://github.com/mscdex/ssh2-streams/pull/174

mrjcgoodwin commented 3 years ago

I've made a pull request on ssh2-streams repo to (temporary) fix this error : mscdex/ssh2-streams#174

Nice work - was on my to-do list for this weekend!

locvfx commented 3 years ago

Please please.. Release an update!

Mickeywaugh commented 3 years ago

I've made a pull request on ssh2-streams repo to (temporary) fix this error : mscdex/ssh2-streams#174

Can not work after local installation.

Natizyskunk commented 3 years ago

I've made a pull request on ssh2-streams repo to (temporary) fix this error : mscdex/ssh2-streams#174

Can not work after local installation.

You 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.

image

Carlos-Freire commented 3 years ago

Thanks @sdir! Work fine for me, MacOs, VSCode 1.56.2, sftp v 1.12.9.

lighthousebulb commented 3 years ago

Sadly this repo looks like it is not maintained any more. Any ideas for a good replacement for this vs-code-extensions?