liximomo / vscode-sftp

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

error 'no such file' during upload on save #915

Open davidesnc opened 3 years ago

davidesnc commented 3 years ago

I have an error during the upload when saving file this is the log on view->option->sftp could you help me ? thanks in advance

[04-26 14:48:02] [error] Error: No such file at SFTPStream._transform (/Users/davide/.vscode-insiders/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js:412:27) at SFTPStream.Transform._read (internal/streams/transform.js:205:10) at SFTPStream._read (/Users/davide/.vscode-insiders/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js:183:15) at SFTPStream.Transform._write (internal/streams/transform.js:193:12) at writeOrBuffer (internal/streams/writable.js:358:12) at SFTPStream.Writable.write (internal/streams/writable.js:303:10) at Channel.ondata (internal/streams/readable.js:719:22) at Channel.emit (events.js:315:20) at addChunk (internal/streams/readable.js:309:12) at readableAddChunk (internal/streams/readable.js:284:9) at Channel.Readable.push (internal/streams/readable.js:223:10) at SSH2Stream. (/Users/davide/.vscode-insiders/extensions/liximomo.sftp-1.12.9/node_modules/ssh2/lib/Channel.js:167:15) at SSH2Stream.emit (events.js:315:20) at parsePacket (/Users/davide/.vscode-insiders/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:3288:10) at SSH2Stream._transform (/Users/davide/.vscode-insiders/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:694:13) at SSH2Stream.Transform._read (internal/streams/transform.js:205:10) at SSH2Stream._read (/Users/davide/.vscode-insiders/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:253:15) at SSH2Stream.Transform._write (internal/streams/transform.js:193:12) at writeOrBuffer (internal/streams/writable.js:358:12) at SSH2Stream.Writable.write (internal/streams/writable.js:303:10) at Socket.ondata (internal/streams/readable.js:719:22) at Socket.emit (events.js:315:20) at addChunk (internal/streams/readable.js:309:12) at readableAddChunk (internal/streams/readable.js:284:9) at Socket.Readable.push (internal/streams/readable.js:223:10) at TCP.onStreamRead (internal/stream_base_commons.js:188:23) when local ➞ remote /opt/data/iseo/progetti/v364/server/uti/internal_obfuscate.php

mbinette commented 3 years ago

I am getting the same issue. I've used this extension for over a year and it only stopped over the weekend. Worked perfectly on Friday, 4/23/2021, but failed first thing this morning. Possibly a VSCode update? I'm using Insiders Edition and haven't tried the regular edition. @davidesnc , are you on Insiders or regular edition of VSCode?

Darktex commented 3 years ago

+1 on insiders. Does seem like it does upload, so it's just a false positive.

mbinette commented 3 years ago

Not a false positive. I agree that some of the times it still writes the files but not others. If you Sync Local -> Remote on a directory for instance some files get wiped out on the remote or end up blank or cut short. My entire build fails after a Sync because of missing file contents on the remote.

davidesnc commented 3 years ago

I am getting the same issue. I've used this extension for over a year and it only stopped over the weekend. Worked perfectly on Friday, 4/23/2021, but failed first thing this morning. Possibly a VSCode update? I'm using Insiders Edition and haven't tried the regular edition. @davidesnc , are you on Insiders or regular edition of VSCode?

I'm using insider version too. I agree that probably was an update of vscode to create the issue. I'm searching for an alternative, may be do you have some suggestions ?

mbinette commented 3 years ago

I opened a bug report on VS Code but there have been a few hundred commits since last Friday. I wasn't able to find anything specific that is an obvious reason for this. I'm going to try installing the non Insiders edition to see if it still works and to check which Nodejs version is being used. The errors are in calls to stream which is internal to Nodejs. Otherwise, I might need to switch to using the Microsoft "Remote - SSH" extension which I didn't want to do since my remote doesn't use git.

mbinette commented 3 years ago

As expected, VS Code, non Insiders, works fine. It is also on Node 12.18.3 where Insiders is on 14.16.0. I'm not sure when Insiders updated but it might be a Node issue.

davidesnc commented 3 years ago

@mbinette thanks for your investigation job.

GOinfo-Ltd commented 3 years ago

Hi. Just confirming that I get the same issue on Insiders. Didn't try normal edition.

davidesnc commented 3 years ago

a stupid workaround, but it works for me. ~/.vscode-insiders/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js row 412 and follow.... / //davidescnc var err = new Error(msg || STATUS_CODE_STR[code] || 'Unknown status'); err.code = code; err.lang = lang; cb(err); / //davidesnc cb();

madwebskills commented 3 years ago

Just another "me too", but to add that switching to "FTP" protocol instead of "SFTP" still works (but very slow for some reason). Not ideal, but helped in a pinch.

GOinfo-Ltd commented 3 years ago

a stupid workaround, but it works for me. ~/.vscode-insiders/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js row 412 and follow.... / //davidescnc var err = new Error(msg || STATUS_CODE_STR[code] || 'Unknown status'); err.code = code; err.lang = lang; cb(err); / //davidesnc cb();

Cleaner approach to this would actually be to edit the line n°386 this from

if (code === false)
  return;

to this

if (code === false || code === STATUS_CODE.NO_SUCH_FILE)
  return;

This way, you don't lose other error warnings, just the "no such file" one. Still, quite bad to have to resort to this kind of workaround...

bika-c commented 3 years ago

Same issue here. Just got updated today normal edition 1.56.0. So I guess they didn't fix the bug in the insider version and now the normal edition has the same problem. Regardless of the error, the files are still synced.

aesculus commented 3 years ago

Cleaner approach to this would actually be to edit the line n°386 this from

if (code === false)
  return;

to this

if (code === false || code === STATUS_CODE.NO_SUCH_FILE)
  return;

This way, you don't lose other error warnings, just the "no such file" one. Still, quite bad to have to resort to this kind of workaround...

This did not work for me. It stuck reporting it was uploading.

I did just implement @davidesnc hack. That works fine on the surface.

feijoa-pine commented 3 years ago

Hello, please overlook my fault if you find because this is the first time to post comment here github.

I was getting same issue with probability normal edition v1.12.9. So, I added a patch code to c:\Users\.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\sftp.js line: 388 like below reference to workarounds which are introduced by davidesnc and Webbeh above.

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

And, restart VSCode.

It seems working well for the present.

bika-c commented 3 years ago

code === STATUS_CODE.NO_SUCH_FILE

Thanks! Hoping the vscode could officially fix this any time soon

Prodian0013 commented 3 years ago

another workaround is to downgrade to 1.55 https://code.visualstudio.com/updates/v1_55

joshuachough commented 3 years ago

Another "me too". also getting this on normal version 1.56.0. however, the upload function does seem to be uploading correctly despite the "no such file" error toast

rendiliaw commented 3 years ago

Hello, please overlook my fault if you find because this is the first time to post comment here github.

I was getting same issue with probability normal edition v1.12.9. So, I added a patch code to c:\Users.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\sftp.js line: 388 like below reference to workarounds which are introduced by davidesnc and Webbeh above.

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

And, restart VSCode.

It seems working well for the present.

It's almost work perfectly, but doesn't work when you sync from local -> remote

Gorvey commented 3 years ago

well, i downgrade vscode to 1.55 and reinstall this ext fix this problem

kineticvenergy commented 3 years ago

I'm also getting this error. I've noticed that it will successfully transfer some files and others will be transferred with zero bytes (resulting in an error). I've rolled back to 1.55 and turned off auto updates for now. Fingers crossed it gets resolved soon.

GOinfo-Ltd commented 3 years ago

This did not work for me. It stuck reporting it was uploading.

Oops, just saw that myself, it stuck reporting the upload of the first file you uploaded in that session.

Do it in line 388 instead : if (code === STATUS_CODE.OK || code === STATUS_CODE.NO_SUCH_FILE) { instead of if (code === STATUS_CODE.OK)

Of course, revert line 386 back.

Result : image

GOinfo-Ltd commented 3 years ago

It's almost work perfectly, but doesn't work when you sync from local -> remote

You may have another issue. Try using the fix in my previous message. If it still doesn't work, use https://github.com/liximomo/vscode-sftp/issues/915#issuecomment-828452687

Mickeywaugh commented 3 years ago

Sure update Issued this bug. I reinstalled version 1.55.2, and sftp extensions works well again.

rendiliaw commented 3 years ago

It's almost work perfectly, but doesn't work when you sync from local -> remote

You may have another issue. Try using the fix in my previous message. If it still doesn't work, use #915 (comment)

Actually, I've already done everything. It's fine when it's come to save file by file. But, when you trying to perform local sync to remote, it become infinite loading... or maybe it just me

rendiliaw commented 3 years ago

The final solution I do, is downgrade to 55

rick3rt commented 3 years ago

It's almost work perfectly, but doesn't work when you sync from local -> remote

Since upload local -> remote also still works, you can apply this patch to avoid seeing the error. In file ...\.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\sftp.js change line 416

cb(err);

to

cb();

That way you can still upload files, dont have to downgrade, and just dont see the annoying error.

GOinfo-Ltd commented 3 years ago

It's almost work perfectly, but doesn't work when you sync from local -> remote

Since upload local -> remote also still works, you can apply this patch to avoid seeing the error. In file ...\.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\sftp.js change line 416

cb(err);

to

cb();

That way you can still upload files, dont have to downgrade, and just dont see the annoying error.

This does the same as my solution, except it discards all errors.

rick3rt commented 3 years ago

@Webbeh I see that this discards all errrors, but your fix didnt solve the erorr on upload local -> remote for me. The error vscode throws me is 'Handle is invalid'. The error code is 4, corresponding to FAILURE.

I reverted my previous patch on line 416, and made line 388:

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

However, this indeed still discards a lot of errors

Jany-M commented 3 years ago

Do it in line 388 instead : if (code === STATUS_CODE.OK || code === STATUS_CODE.NO_SUCH_FILE) { instead of if (code === STATUS_CODE.OK)

That didnt work for me, local -> remote still not uploading and getting popup error.

But this did!

dvelopin commented 3 years ago

Another "same here", updated to latest VS Code and suddenly had this issue. Been using it for a couple years now.

gfernandez-me commented 3 years ago

same here using non-insiders

gfernandez-me commented 3 years ago

a stupid workaround, but it works for me. ~/.vscode-insiders/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js row 412 and follow.... / //davidescnc var err = new Error(msg || STATUS_CODE_STR[code] || 'Unknown status'); err.code = code; err.lang = lang; cb(err); / //davidesnc cb();

now it's taking forever to finish when uploading minified js files

gfernandez-me commented 3 years ago

https://github.com/microsoft/vscode/wiki/Virtual-Workspaces

Is my extension affected?

Extension with code, that means extensions that define a main entry point, require inspection and, possibly, adoption.

Maybe we need add to the list

https://github.com/microsoft/vscode/issues/122836

TheFivery commented 3 years ago

Just chiming in... Using insiders and experiencing the same issue - "No such file" error. Finally irritated me enough to do something about it. @Webbeh's sollution worked for me - quoted below.

Do it in line 388 instead : if (code === STATUS_CODE.OK || code === STATUS_CODE.NO_SUCH_FILE) { instead of if (code === STATUS_CODE.OK)

Result : image

netdjw commented 3 years ago

I work local -> remote mode, and none of above suggestions solved the problem. Some files are uploaded but others not.

I tried to downgrade vscode too, but it autoupgraded itself after a restart - honestly I don't want to work with an older software, because of security and stability risks.

Is there any plan to fix this bug?

netdjw commented 3 years ago

until this will be fix I use scp linux shell command:

scp -r ./local-folder myuser@myexamplehost.com:/var/www/path/to/my-dir/.

GOinfo-Ltd commented 3 years ago

You all need to start mentioning which OS you're using VSCode on...

TheFivery commented 3 years ago

You all need to start mentioning which OS you're using VSCode on...

My apologies. I'm using Pop OS 20.10 and VS Code Insiders 1.57.0. And thank you for developing an extension that I use daily. I know it must be frustrating to fix bugs that vscode has caused.

mbinette commented 3 years ago

Should this issue be logged with the ssh2-streams or ssh2 projects? It seems like this extension only broke because those libraries are returning something different than expected.

netdjw commented 3 years ago

You all need to start mentioning which OS you're using VSCode on...

Sorry, I'm using Windows 10 Home 20H2 (build: 19042.964)

VS Code: Version: 1.56.1 (user setup) Commit: e713fe9b05fc24facbec8f34fb1017133858842b Date: 2021-05-06T10:08:05.141Z 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.19042

I use VSCode from WSL 2.

In WSL I use Ubuntu 20.04.

ylynfatt commented 3 years ago

I'm getting the same issue but the files do seem to upload successfully despite the error message. I am using:

Version: 1.56.1 Commit: e713fe9b05fc24facbec8f34fb1017133858842b Date: 2021-05-06T10:08:24.325Z Electron: 12.0.4 Chrome: 89.0.4389.114 Node.js: 14.16.0 V8: 8.9.255.24-electron.0 OS: Darwin x64 20.4.0 (macOS Big Sur 11.3.1)

rendiliaw commented 3 years ago

Version: 1.55.2 (system setup) Commit: 3c4e3df9e89829dce27b7b5c24508306b151f30d Date: 2021-04-13T09:35:57.887Z Electron: 11.3.0 Chrome: 87.0.4280.141 Node.js: 12.18.3 V8: 8.7.220.31-electron.0 OS: Windows_NT x64 6.1.7601

Still hold at 1.55 Once you upgrade to 1.56, it's gonna be the end road

heyaco commented 3 years ago

Where the patch at?

StrasGus commented 3 years ago

Hello, please overlook my fault if you find because this is the first time to post comment here github.

I was getting same issue with probability normal edition v1.12.9. So, I added a patch code to c:\Users.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\sftp.js line: 388 like below reference to workarounds which are introduced by davidesnc and Webbeh above.

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

And, restart VSCode.

It seems working well for the present.

It work fine for me ! Thanks.

jewettg commented 3 years ago

POSTED TO Stack Overflow: https://stackoverflow.com/questions/67506693/vscode-error-no-such-file-sftp-liximomo-extension/67524099#67524099

See post in Issue #934.

hscsolutions1 commented 3 years ago

Same here: vscode 1.56.0 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.19042

GOinfo-Ltd commented 3 years ago

For everyone implementing any of those fixes : please roll them back and use the fix in https://github.com/liximomo/vscode-sftp/issues/919#issuecomment-836005639

It will work better for everyone, no matter your OS.

And stop waiting for an update to this plugin, it's most likely not gonna happen :(

ZihaoZheng98 commented 3 years ago

yeah,this is a false negative = =

mattizhu commented 3 years ago

Can confirm, I can upload/download from my remote path just fine but gives me a "No such file" error regardless. Rolling back to the previous version works fine with no error messages.

GOinfo-Ltd commented 3 years ago

@ZihaoZheng98 @mattizhu there's a fix 3 posts before this one.