liximomo / vscode-sftp

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

Error: failure #356

Open szymoneko opened 5 years ago

szymoneko commented 5 years ago

Hi,

It's work excellente but after update i've problem:

[error] Error: Failure at SFTPStream._transform (.vscode\extensions\liximomo.sftp-1.6.3\node_modules\ssh2-streams\lib\sftp.js:412:27) at SFTPStream.Transform._read (_stream_transform.js:186:10) at SFTPStream._read (.vscode\extensions\liximomo.sftp-1.6.3\node_modules\ssh2-streams\lib\sftp.js:183:15) at SFTPStream.Transform._write (_stream_transform.js:174:12) at doWrite (_stream_writable.js:387:12) at writeOrBuffer (_stream_writable.js:373:5) at SFTPStream.Writable.write (_stream_writable.js:290:11) at Channel.ondata (_stream_readable.js:639:20) at emitOne (events.js:116:13) at Channel.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at Channel.Readable.push (_stream_readable.js:208:10) at SSH2Stream. (.vscode\extensions\liximomo.sftp-1.6.3\node_modules\ssh2\lib\Channel.js:166:15) at emitOne (events.js:116:13) at SSH2Stream.emit (events.js:211:7) at parsePacket (.vscode\extensions\liximomo.sftp-1.6.3\node_modules\ssh2-streams\lib\ssh.js:3445:10) at SSH2Stream._transform (.vscode\extensions\liximomo.sftp-1.6.3\node_modules\ssh2-streams\lib\ssh.js:671:13) at SSH2Stream.Transform._read (_stream_transform.js:186:10) at SSH2Stream._read (.vscode\extensions\liximomo.sftp-1.6.3\node_modules\ssh2-streams\lib\ssh.js:253:15) at SSH2Stream.Transform._write (_stream_transform.js:174:12) at doWrite (_stream_writable.js:387:12) at writeOrBuffer (_stream_writable.js:373:5) at SSH2Stream.Writable.write (_stream_writable.js:290:11) at Socket.ondata (_stream_readable.js:639:20) at emitOne (events.js:116:13) at Socket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at Socket.Readable.push (_stream_readable.js:208:10) at TCP.onread (net.js:594:20)

szymoneko commented 5 years ago

{ "protocol": "sftp", "host": "127.0.0.1", "port": 2222, "username": "...", "password": "...", "remotePath": "...", "watcher": { "files": "*/", "autoUpload": false, "autoDelete": false }, "uploadOnSave": true, "syncMode": "full", "ignore": [ "/.vscode", "/.git", "**/.DS_Store" ] }

liximomo commented 5 years ago

It's work excellente. Which version? Does it work now? Downgrading Visual Studio Code extension.

but after update i've problem. Does this error always happen?

FYI. The failure error message comes from the remote side and is more or less the default/generic error message that SSH' sftp server sends when a syscall fails or similar. To know what exactly is going wrong you could try to enable debug output for the sftp server and then execute your transfers again and see what (if anything) shows up in the logs there.

szymoneko commented 5 years ago

It doesn't work. Still the sam error.

Does this error always happen?

Always, after update.

Which version? Does it work now? Downgrading Visual Studio Code extension.

Example link: https://liximomo.gallery.vsassets.io/_apis/public/gallery/publisher/liximomo/extension/sftp/1.5.13/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage Is it ok?

szymoneko commented 5 years ago

Ok, I've disabled extension autoupdate options and it's work on 1.5.13 version. There is a problem o 1.6 version.

liximomo commented 5 years ago

Can you provide the full logs of v1.6.3.

  1. Open User Settings.

    • On Windows/Linux - File > Preferences > Settings
    • On macOS - Code > Preferences > Settings
  2. Set sftp.printDebugLog to true and reload vscode.
  3. Reproduce the problem, get the logs from View > Output > sftp.
szymoneko commented 5 years ago

https://pastebin.com/fjtZHq2m Full logs :)

liximomo commented 5 years ago

Sorry, can't see any errors.

szymoneko commented 5 years ago

Sorry, can't see any errors.

At line 4116. [error] Error: Failure

bscript commented 5 years ago

I have the same issues ! it's was workign fine before ! any news ?

philipaarseth commented 5 years ago

Got the same issue as well. https://pastebin.com/RGU5SmsA

liximomo commented 5 years ago

@szymoneko @bscript @philipaarseth https://github.com/liximomo/vscode-sftp/blob/master/FAQ.md#error-failure

szymoneko commented 5 years ago

But I've go Windows 10

philipaarseth commented 5 years ago

I got it to work. It's part of my hosting file structure, I needed to put the full path, not just "remote-path": "/", but "remotePath": "/customers/c/4/d/domain.com/httpd.www/",

@liximomo maybe you could add it as a suggestion in the FAQ πŸ‘

aanjaneyam commented 5 years ago

I just installed version I can't get it to work with full remote path too. Always get error failure. It just downloads the folder and not any files.

aanjaneyam commented 5 years ago

Ok now it seems to work. After I added syncmode:full, rewrote the remotepath and saved the sftp.json file. I then click Sync remote->local to download all the remote files to local environment. However, it still gave random error:failure couple of times after the password timed out and I pressed Sync remote->local again to continue the download. And then it started downloading again. It gets stuck with long sync as needs password all the time. Is it possible to cache or store the password in the simple config (not profiles).

Eddy805 commented 5 years ago

Possible solution:

I had the same issue. As it seemed, my problem was my remotePath /home/edwin/projects/website contained a symlink, that was not handled well, resulting in [error] Error: Failure.

Changing the remote path to the actual path the symlink was linking to, /usr/share/nginx/website solved this.

sebastianjung commented 5 years ago

Yeah we are having the same problem with symlinks here. Strangely using the symlink works for me but not for my colleague. Both same setup:

_Vscode Version _SFTP Extension Version _sftp.json file

sdir commented 5 years ago

symbolic Link directory ?

sebastianjung commented 5 years ago

@sdir Yeah, like so:

"/project-a/public"

where public is the symlink directory

qhsong commented 5 years ago

Possible solution:

I had the same issue. As it seemed, my problem was my remotePath /home/edwin/projects/website contained a symlink, that was not handled well, resulting in [error] Error: Failure.

Changing the remote path to the actual path the symlink was linking to, /usr/share/nginx/website solved this.

I have same issues and change symlink to hard link solve this problem. But I use symlink directory before, It works. And suddenly, it failed. Wired.

Shaffron commented 5 years ago

In my case

use symlink path: some file upload fail use absolute path: everything is all right (until now)

srshue commented 5 years ago

I face the same issue. List directory works fine but file upload wont work.

Error: Failure sftp.js:412 at SFTPStream._transform (c:\SURESH\vsoncode\NodeCode\algorithmserviceGL\node_modules\ssh2-streams\lib\sftp.js:412:27) at SFTPStream.Transform._read (_stream_transform.js:186:10) at SFTPStream._read (c:\SURESH\vsoncode\NodeCode\algorithmserviceGL\node_modules\ssh2-streams\lib\sftp.js:183:15) at SFTPStream.Transform._write (_stream_transform.js:174:12) at doWrite (_stream_writable.js:387:12) at writeOrBuffer (_stream_writable.js:373:5) at SFTPStream.Writable.write (_stream_writable.js:290:11) at Channel.ondata (_stream_readable.js:639:20) at emitOne (events.js:116:13) at Channel.emit (events.js:211:7)

My code

var conn = new Client(); conn.on('ready', function() { conn.sftp(function(err, sftp) { if (err) throw err;

            var fs = require("fs"); // Use node filesystem
            var readStream = fs.createReadStream( "C:/Users/path/file.txt" );
            var writeStream = sftp.createWriteStream( remotePathToList );

            writeStream.on('close',function () {
                console.log( "- file transferred succesfully" );
            });

            writeStream.on('end', function () {
                console.log( "sftp connection closed" );
                conn.close();
            });

            // initiate transfer of file
            readStream.pipe( writeStream );
        });
    }).connect(connSettings);
esemlabel commented 4 years ago

I have the same "Error: Failure" issue.

Suggestions above didn't help. Remote path is absolute.

config

{
    "name": "project",
    "host": "192.168.10.10",
    "protocol": "sftp",
    "port": 22,
    "username": "*****",
    "password": "*****",
    "remotePath": "/opt/applications/project",
    "ignore": [".vscode", ".git", "node_modules", ".DS_Store"],
    "uploadOnSave": false,
    "watcher": {
        "files": "**/*",
        "autoUpload": true,
        "autoDelete": true
    }
}

sftp.log (look to the end of file)

Any suggestions? ~p.s. the problem appeared recently before vscode 1.39 update I guess.~

Update ~Checked on previous versions of vscode up to 1.37.0 / sftp 1.12.0 - the same issue. Looks like the problem might be somewhere else. But it appears and repeats only after changing git branch. Any further attempts to sync to remote ends the same way. But if I clean remote folder before run sync - all work or, sync completes successful. But again, any further branch change will break sync, and only one way to fix is completely cleanup destination folder on remote to properly sync again. Can't tell why this happen, but I've found that branches may differ by existence of symbolic (shortcuts) link files. ~

~@szymoneko, can you please check if folders with symbolic links syncs fine when changing branches?~

Update 2 Disabling watcher solves the issue, but now I have to run sync manually each time. So it appears to be an issue with watcher right during switching branches.

Update 3 Looks like symbolic links persistent really matters, or idk what else. Because now even manual sync Failure

[10-24 13:18:21] [error] Error: Failure
    at SFTPStream._transform (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js:412:27)
    at SFTPStream.Transform._read (_stream_transform.js:190:10)
    at SFTPStream._read (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js:183:15)
    at SFTPStream.Transform._write (_stream_transform.js:178:12)
    at doWrite (_stream_writable.js:410:12)
    at writeOrBuffer (_stream_writable.js:394:5)
    at SFTPStream.Writable.write (_stream_writable.js:294:11)
    at Channel.ondata (_stream_readable.js:666:20)
    at Channel.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Channel.Readable.push (_stream_readable.js:219:10)
    at SSH2Stream.<anonymous> (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2/lib/Channel.js:167:15)
    at SSH2Stream.emit (events.js:182:13)
    at parsePacket (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:3288:10)
    at SSH2Stream._transform (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:694:13)
    at SSH2Stream.Transform._read (_stream_transform.js:190:10)
    at SSH2Stream._read (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:253:15)
    at SSH2Stream.Transform._write (_stream_transform.js:178:12)
    at doWrite (_stream_writable.js:410:12)
    at writeOrBuffer (_stream_writable.js:394:5)
    at SSH2Stream.Writable.write (_stream_writable.js:294:11)
    at Socket.ondata (_stream_readable.js:666:20)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) when local ➞ remote /Users/usr/Documents/work/Git/project/php-lib/tools/vendor/simplesamlphp/simplesamlphp/locales/no
[10-24 13:18:21] [info] local ➞ remote /Users/usr/Documents/work/Git/project/project/packing_slip.php
[10-24 13:18:21] [info] local ➞ remote /Users/usr/Documents/work/Git/project/php-lib/tools/vendor/bin/export-plural-rules
[10-24 13:18:21] [info] local ➞ remote /Users/usr/Documents/work/Git/project/php-lib/tools/vendor/bin/export-plural-rules.php
joaovitordpf commented 4 years ago

Thanks Man! It worked perfectly!

clayperez commented 4 years ago

Possible Culprit: No More Drive Space. I found that I was getting this nondescript error because I was out of drive space. I cleared out the runaway logs folder and freed up 40GB of uselessness and power-cycled the server. Problem solved. That is to say that the issue was not vscode-sftp, but rather my own carelessness in monitoring my server log consumption.

Proposal: Enhance error messaging in sftp.js Is there a way to capture disc space and report it to the user when there is an error like this?

esemlabel commented 4 years ago

200Gigs free space. So that is not a reason in my case.

cloudqubes commented 4 years ago

Had a similar issue. Found the problem to be the "remotePath" was pointing to a symlink on Linux server. When changed to the actual path, problem solved.

esemlabel commented 4 years ago

@cloudqubes, that is not my case. "remotePath" is set to absolute.

sergei-beloglazov commented 4 years ago

I have the same issue with symlink in "remotePath". It works only with real path. Additionally SFTP browser doesn't show symlink directories on server in list.

egoan82 commented 4 years ago

Good day to all

I had the same problem, but I fixed it with the absolute path.

I also want to indicate that this problem does not occur in subdomains only in the main domain.

Greetings from Colombia co

justinvoelker commented 4 years ago

Same Error: Failure issue here. This is failing for a brand new React project. Simply create a directory, create a new React app in that directory with npx create-react-app . and then try to download that directory into VSCode. The "Error: Failure" appears and only the directory structure is downloaded.

The problem appears to be within the node_modules directory as I am able to download the public and src directories without problem.

I am not out of drive space remotely or locally, my remotePath is absolute, the directory itself is not a symbolic link.

mabho commented 4 years ago

I have experienced a similar issue and was pulling my hair out. It turns out the issue was related to the path. At first, I thought I needed to setup an absolute path relative to server root, but that didn't work. Then I realized I needed to setup the path relative to default location my server user was logging in. Example: instead of /var/www/html/my-app, let's say my user logs in by default at /var/www. The path I needed to set on sftp.json for key remotePath was /html/my-app.

justinchou commented 3 years ago

i got the same issue, and i figured that my server disk space is full.

after clean up some free space, it succeed.

esemlabel commented 3 years ago

i got the same issue, and i figured that my server disk space is full.

Mine is not.

C0ldstudy commented 3 years ago

i got the same issue, and i figured that my server disk space is full.

after clean up some free space, it succeed.

Thanks! Same Problem Here!

DennisTap commented 3 years ago

My bottleneck was a cache directory. I put it as ignore ("ignore": [".vscode", ".git", "node_modules", ".DS_Store", "cache"],) and that solve my problem.

I think what could be the problem is the length of the path + filename

esemlabel commented 3 years ago

@DennisTap, yeah, could be the case. My sync in most cases fails at the same point, for instance Git/project/php-library/tools/vendors/simplesamlphp/simplesamlphp/locales/no

esemlabel commented 3 years ago

One of the file that failed to sync is a shortcut to folder image

Error: Failure
    at SFTPStream._transform (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js:412:27)
    at SFTPStream.Transform._read (_stream_transform.js:189:10)
    at SFTPStream._read (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js:183:15)
    at SFTPStream.Transform._write (_stream_transform.js:177:12)
    at doWrite (_stream_writable.js:435:12)
    at writeOrBuffer (_stream_writable.js:419:5)
    at SFTPStream.Writable.write (_stream_writable.js:309:11)
    at Channel.ondata (_stream_readable.js:728:22)
    at Channel.emit (events.js:223:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at Channel.Readable.push (_stream_readable.js:224:10)
    at SSH2Stream.<anonymous> (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2/lib/Channel.js:167:15)
    at SSH2Stream.emit (events.js:223:5)
    at parsePacket (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:3288:10)
    at SSH2Stream._transform (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:694:13)
    at SSH2Stream.Transform._read (_stream_transform.js:189:10)
    at SSH2Stream._read (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:253:15)
    at SSH2Stream.Transform._write (_stream_transform.js:177:12)
    at doWrite (_stream_writable.js:435:12)
    at writeOrBuffer (_stream_writable.js:419:5)
    at SSH2Stream.Writable.write (_stream_writable.js:309:11)
    at Socket.ondata (_stream_readable.js:728:22)
    at Socket.emit (events.js:223:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:181:23) when local ➞ remote /Users/usr/Documents/pr/php-lib/tools/vendor/simplesamlphp/simplesamlphp/locales/no
kl990899 commented 3 years ago

In my case, I fixed this similar problem by clear my rails tmp/cache file. I was lucky to solve this problem but I don’t know why. Is there possible a file size too big to Sync remote to local?

esemlabel commented 3 years ago

I don't think it has something to do with file size. In my case I noticed that sync just stucks during these cases: – When switching branches. – When pulling stash into the working tree. – When working tree contain shortcut (link) file. I tried few time on fresh Mac OS setup and it didn't help though. Mac OS, vagrant through sftp with watcher setting enabled.

puazgit commented 2 years ago

My bottleneck was a cache directory. I put it as ignore ("ignore": [".vscode", ".git", "node_modules", ".DS_Store", "cache"],) and that solve my problem.

I think what could be the problem is the length of the path + filename

Thanks Bro this work for me

Venegrad commented 2 years ago

Same issue

Kevinwuu commented 2 years ago

Same issue. Finally I solved this by downgrade vscode to v1.55 https://code.visualstudio.com/updates/v1_55

omicr0n commented 1 year ago

Thanks to some of the suggestions in here I encountered this same issue and the fix turned out to be not using a symlinked directory as the remotePath. I had it set to /var/www/html/ but that folder is a symlink to /storage/server/var/www/html/ on the server I was connecting too, changing remotePath to /storage/server/var/www/html/ fixed the issue.