Robert-W / grunt-ftp-push

Deploy files to an FTP server as part of your Grunt workflow.
MIT License
39 stars 14 forks source link

Uploads just one file #56

Open Wombosvideo opened 7 years ago

Wombosvideo commented 7 years ago

Uploads one file and then it hangs. It doesn't do any more. Just uploads one single file even if there are a dozen more in the directory. After around 5 to 10 minutes I get this error message.

Fatal error: read ECONNRESET

which basically says nothing. I tried to debug the code and it seems to fail to execute "pasv" the second time though I wouldn't know why or how to fix it or anything.

I am running on the following config:

init_php: {
  options: {
    host: ftp_host,
    username: ftp_user,
    password: ftp_pass,
    dest: "/",
    port: 21,
    incrementalUpdates: false, // I tried "true" too
    debug: true // Doesn't really do anything
  },
  files: [
    {
      expand: true,
      cwd: '.',
      src: 'dist/php/**/*' // This is a directory containing two files
    }
  ]
},

and

Windows_NT 10.0.15062
node 7.10.0
npm 4.2.0
grunt 1.0.1
grunt-ftp-push 1.2.1
Robert-W commented 7 years ago

Hi @Wombosvideo,

Can you check if you are having any connection issues to your server? ECONNRESET typically means the connection with the server on the other side was abruptly closed. This can sometimes be caused by the ftp server being overloaded at that time or many other factors.

As far as your configuration is concerned, that looks fine and should not be the source of an issue, are these small or large files that you are uploading?

Wombosvideo commented 6 years ago

Connection is just fine and the server is fine too because I can upload 100 files in a row without disconnecting between uploads using my JAVA FTP uploader which I use now instead of this grunt module. Bug still exists but it doesn't bother me anymore. I guess the error is hiding in jsftp itself

Robert-W commented 6 years ago

Ok, yea so ECONNRESET is a pretty generic error and can happen for many reasons. If other FTP client's work it is possible that jsftp is having issues with the server and is unexpectedly dropping the connection. I have seen it work better or worse depending on what the domain is and other network settings.

I'll keep this open for now in case anyone else see's the same issue and then I can file something over on the jsftp github page.

M00rphy commented 2 years ago

I'm having this exact same problem

Wombosvideo commented 2 years ago

The problem very likely is still on the server-side, even though normal FTP works fine in a client like FileZilla or sorts. The provider I use implements its own FTP server which is strongly regulated due to security reasons. Maybe one of these "security features" is preventing multiple file transfers at once.

I personnally do not use grunt-ftp-push anymore because I moved to a more production ready environment using Gitlab's CI/CD feature which performs the uploading with rsync over SSH every time I push a new commit passing my tests. I strongly recommend not to use FTP at all anymore as it's pretty insecure. Especially nowadays when you get bombarded with brute-force login attacks multiple times a day.