FTP-Deploy-Action icon indicating copy to clipboard operation
FTP-Deploy-Action copied to clipboard

"Error: Server sent FIN packet unexpectedly, closing connection."

Open alasdairnmanson opened this issue 8 months ago โ€ข 5 comments

Bug Description Thank you for this awesome tool. It does exactly what I need and yet I keep getting this error. I would appreciate any help.

Host is Dreamhost and SFTP client (Filezilla) works just fine with the same credentials, server address and port.

My Action Config

name: ๐Ÿš€ Deploy bot on push

on:
  push:
    branches:
      - main
jobs:
  build-and-deploy:
    name: ๐ŸŽ‰ Build and Deploy Website
    runs-on: ubuntu-latest

    steps:
      - name: ๐Ÿšš Get latest code
        uses: actions/checkout@v4

      - name: ๐Ÿ“‚ Sync files via FTP
        uses: SamKirkland/[email protected]
        with:
          server: pdx1-shared-a1-29.dreamhost.com
          protocol: ftps
          port: 22
          log-level: verbose
          username: ${{ secrets.FTP_USERNAME }}
          password: ${{ secrets.FTP_PASSWORD }}
          server-dir: /home/${{ secrets.FTP_USERNAME }}/alasdairmanson.org/
          timeout: 200000

My Action Log

Run SamKirkland/[email protected]
----------------------------------------------------------------
๐Ÿš€ Thanks for using ftp-deploy. Let's deploy some stuff!   
----------------------------------------------------------------
If you found this project helpful, please support it
by giving it a โญ on Github --> https://github.com/SamKirkland/FTP-Deploy-Action
or add a badge ๐Ÿท๏ธ to your projects readme --> https://github.com/SamKirkland/FTP-Deploy-Action#badge
Using the following excludes filters: ["**/.git*","**/.git*/**","**/node_modules/**"]
Creating local state at ./.ftp-deploy-sync-state.json
Local state created
Connected to 69.163.177.234:22 (No encryption)
< SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.13

> QUIT
Failed to connect, are you sure your server works via FTP or FTPS? Users sometimes get this error when the server only supports SFTP.

----------------------------------------------------------------
--------------  ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ an error occurred  ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ  --------------
----------------------------------------------------------------

----------------------------------------------------------------
----------------------  full error below  ----------------------
----------------------------------------------------------------

Error: Server sent FIN packet unexpectedly, closing connection.
    at Socket.<anonymous> (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/v4.3.5/dist/index.js:5109:56)
    at Socket.emit (node:events:536:35)
    at endReadableNT (node:internal/streams/readable:1698:[12](https://github.com/alasdairnmanson/alasdairmanson.org/actions/runs/14724039425/job/41322979370#step:3:13))
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Error: Error: Server sent FIN packet unexpectedly, closing connection.

alasdairnmanson avatar Apr 29 '25 05:04 alasdairnmanson

hey @SamKirkland

i wanted to try to work this out on my own, or at least isolate it. i tried a bunch of other ftp deployers and they all failed until this one: https://github.com/sand4rt/ftp-deployer

it allows me to specify "passive: true" and i think that's the difference?

alasdairnmanson avatar Apr 29 '25 22:04 alasdairnmanson

@alasdairnmanson It seems you moved on to another solution, but using port 22 for FTPS is strange - that is an SSH port, it works with SFTP connections. For FTPS you need port 21 - it worked for me, however I'm not on Dreamhost.

MariusStuparu avatar May 23 '25 14:05 MariusStuparu

Hi @alasdairnmanson ๐Ÿ‘‹

I struggled with the exact same issueโ€”everything worked perfectly with FileZilla, but when running from GitHub Actions, it just wouldnโ€™t connect. After a lot of digging, I discovered that my hosting provider had a setting to block access from foreign IP addresses. Once I disabled that restriction, FTP-Deploy-Action worked from GitHub Actions without any problems.

You might want to check if your hosting provider has a similar IP restriction in place. It could be worth looking into! ๐Ÿš€

nekonenene avatar May 28 '25 18:05 nekonenene

Same problem, when deploying many files, I get a FIN error!

olton avatar Jul 19 '25 07:07 olton

I have a documentation site with numerous catalogs. When the action runs, it first creates directories and then copies files. When directories are created, the ftp server thinks that nothing is happening and after a while simply disconnects. To prevent this from happening, passive mode support is required.

To avoid this error, you need passive mode. TY.

olton avatar Jul 21 '25 08:07 olton