Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: handle is not a Buffer while doing scp #18

Open
shabfactor opened this issue Nov 12, 2014 · 3 comments
Open

Fatal error: handle is not a Buffer while doing scp #18

shabfactor opened this issue Nov 12, 2014 · 3 comments

Comments

@shabfactor
Copy link

my gruntfile.js is below

  secret: grunt.file.readJSON('environment.json'),
  scp: {
       test:{
         options: {
           host: '<%= secret.server1.host %>',
           username: '<%= secret.server1.username %>',
           privateKey: '<%= grunt.file.read(secret.server1.privateKey) %>',
           showProgress: true
          // tryKeyboard: true
         }, 
         files: [{
             cwd: './dist',
             src: '**/*',
             filter: 'isFile',
             dest: '/path/to/folder/project.test'
         }]  
       },
       prod: {
         options: {
           host: '<%= secret.server2.host %>',
           username: '<%= secret.server2.username %>',
           privateKey: '<%= grunt.file.read(secret.server2.privateKey) %>',
           tryKeyboard:true
         },
         files: [{
             cwd: './dist',
             src:'**/*',
             dest:'/srv/www/vhosts/project'
         }]
       } 
   } `

when i try to deploy to test
i get following error

               [31mFatal error: handle is not a Buffer��[39m
              14:28:21 
              14:28:21 
              14:28:21 Execution Time (2014-11-12 01:25:31 UTC)

please help, Thanks

@shabfactor
Copy link
Author

what i figure out is when it does scp it does not set proper rights on the folder which should be 775 so please tell me a way to set rights while doing scp in grunt.

@francadaval
Copy link

In the files configurations you must add 'filter': 'isFile'.

The plugin manage all entries as files and fails when any entry is a folder.

@Narimm
Copy link

Narimm commented Nov 14, 2019

This issue is always caused by File perms - the above method may not fix your problem

  1. Check the path on the target - that the user your 'scp' ing to has perms to read, write and traverse that directory
  2. Check existing files in the directory have the same permissions for that user -

use grunt -v scp:your_target and review the error - if it shows a path similar to
path/directory/newfile.ext/newfile.ext it means it cannot overwrite the existing file.

You can use file access lists if required to set the perms correctly.

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

No branches or pull requests

3 participants