Skip to content
This repository has been archived by the owner on Feb 5, 2022. It is now read-only.

0.2.0 always gives "Error: handle is not a Buffer" #21

Open
domenic opened this issue Dec 12, 2014 · 13 comments
Open

0.2.0 always gives "Error: handle is not a Buffer" #21

domenic opened this issue Dec 12, 2014 · 13 comments
Labels

Comments

@domenic
Copy link

domenic commented Dec 12, 2014

See for example https://travis-ci.org/whatwg/streams/builds/43789094#L1383

compared to https://travis-ci.org/whatwg/streams/builds/39141547#L863 with 0.1.4

(Also I might suck at shell scripting but I can't my Travis builds to fail when ssh2 throws an error :-/turns out I need to use Travis's script hook instead of after_success)

domenic added a commit to whatwg/streams that referenced this issue Dec 12, 2014
@domenic
Copy link
Author

domenic commented Dec 12, 2014

This seems related to the fact that I am trying to scp into directories which don't yet exist, since scping to index.html works fine. My guess is that 0.1.4 would do a mkdir -p equivalent for me, whereas 2.0.0 stopped doing that. (The fact that the error message sucks is presumably a separate bug.)

domenic added a commit to whatwg/streams that referenced this issue Dec 12, 2014
Due to a bug (spmjs/node-scp2#21) in the program we are using to ssh snapshots onto streams.spec.whatwg.org, commit and branch snapshots have not been being properly deployed since late October. Fixed this by pinning scp2@0.1.4

Worse, we weren't getting notified of this failure because I was erroneously using Travis CI's `after_success` hook to build and deploy the spec and spec snapshots; if that fails, Travis does not notify you. Fixed by using the `script` hook instead.
@lepture lepture added the bug label Dec 12, 2014
@alxlv
Copy link

alxlv commented Jan 23, 2015

It does not work for me too.

@Fr33maan
Copy link

Exactly the same errors, does it come from scp2 or from a dependency ?

@ChristopherHackett
Copy link

Same here. if I drop the version down to 0.1.4 it works.

@airyland
Copy link

airyland commented Jun 4, 2015

also with 0.2.2

@lepture
Copy link
Contributor

lepture commented Jun 4, 2015

Maybe it is related to #32

@Nepoxx
Copy link

Nepoxx commented Oct 7, 2015

Are you guys only seeing this on a specific platform?

For me (Ubuntu -> Ubuntu) scp2 0.2.2 creates the folders just fine, but for my coworker (Windows -> Ubuntu), the created folders lack the proper permissions (-x) and gives the Error: handle is not a Buffer error.

@Nepoxx
Copy link

Nepoxx commented Oct 7, 2015

The issue is that upload calls mkdir with incorrect attributes. attrs.mode is set to what fs.stat() returns for a file, which is not in the CHMOD format (0755 and whatnot).

Also, unfortunately, in windows the permissions on folders will not have the execute bit set, which means that folders will not be executable on the remote host.

 attrs.mode = attrs.mode ? '0' + (attrs.mode & 0777).toString(8) : '0755'

would solve the first issue, but I'm not sure how to deal with Windows permissions.

@dev4q1
Copy link

dev4q1 commented Oct 26, 2015

I am getting the following issue:

../wp-gulp-automation/node_modules/scp2/node_modules/ssh2/lib/SFTP/SFTPv3.js:227
    throw new Error('handle is not a Buffer');
          ^
Error: handle is not a Buffer
    at SFTP.write (../wp-gulp-automation/node_modules/scp2/node_modules/ssh2/lib/SFTP/SFTPv3.js:227:11)
    at ../wp-gulp-automation/node_modules/scp2/lib/client.js:208:18
    at FSReqWrap.wrapper [as oncomplete] (fs.js:527:17)

Process finished with exit code 1

But I noticed that the file was created on the sftp-server but without content.

@xujihui1985
Copy link
Contributor

I found the attrs.mode on windows is not same as it on *nix. I have the same error in windows client, I just brucly set the attrs.mode='755', and it work

@xiaoyann
Copy link

because the dir of destination does not create before execute write

@vikramparth
Copy link

Any updates on this issue? I'm still running into it with the latest version of node-scp2.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests