SamKirkland / FTP-Deploy-Action

Deploys a GitHub project to a FTP server using GitHub actions
MIT License
3.92k stars 375 forks source link

Sync Problem ftp-deploy-sync-state.json available but not detected #447

Open teamITGoldenEnglish opened 8 months ago

teamITGoldenEnglish commented 8 months ago

Bug Description: I already using 4.3.3 and it run normally, but somehow the github action wont work. So i decided to upgrade to 4.3.4 . But i got another issue.

My Github Action: on: push: branches:


-------------- 🔥🔥🔥 an error occurred 🔥🔥🔥 --------------


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

Error: Server sent FIN packet unexpectedly, closing connection. at Socket. (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/v4.3.3/dist/index.js:5097:56) at Socket.emit (node:events:525:35) at endReadableNT (node:internal/streams/readable:1358:12) at processTicksAndRejections (node:internal/process/task_queues:83:21) Error: Error: Server sent FIN packet unexpectedly, closing connection.

lewismoten commented 5 months ago

I'm having the same problem. Around 1:30 AM to 2:00 AM, my FTP server starts acting weird. Maybe maintenance by the host? The build server can authenticate, but it is unable to detect the .ftp-deploy-sync-state.json file, and wants to upload everything. The first thing it wants to do is create a folder - and fails with the FIN packet.

Missing server files

----------------------------------------------------------------
No file exists on the server "./.ftp-deploy-sync-state.json" - this must be your first publish! 🎉
The first publish will take a while... but once the initial sync is done only differences are published!
If you get this message and its NOT your first publish, something is wrong.
----------------------------------------------------------------
Local Files:    1,390
Server Files:   0
----------------------------------------------------------------
Calculating differences between client & server
----------------------------------------------------------------

The error

----------------------------------------------------------------
Making changes to 1390 files/folders to sync server state
Uploading: 5.28 MB -- Deleting: 0 B -- Replacing: 0 B
----------------------------------------------------------------
creating folder "common/"

----------------------------------------------------------------
--------------  🔥🔥🔥 an error occurred  🔥🔥🔥  --------------
----------------------------------------------------------------

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

Error: Client is closed because Server sent FIN packet unexpectedly, closing connection.
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/v4.3.5/dist/index.js:5208:29
    at new Promise (<anonymous>)
    at FTPContext.handle (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/v4.3.5/dist/index.js:5190:16)
    at Client.sendIgnoringError (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/v4.3.5/dist/index.js:4226:25)
    at Client._openDir (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/v4.3.5/dist/index.js:4753:20)
    at Client.ensureDir (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/v4.3.5/dist/index.js:4744:24)
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/v4.3.5/dist/index.js:3555:126
    at Generator.next (<anonymous>)
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/v4.3.5/dist/index.js:3540:71
    at new Promise (<anonymous>)
Closing reason: 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:531:35)
    at endReadableNT (node:internal/streams/readable:1696:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: '0'
}
Error: Error: Client is closed because Server sent FIN packet unexpectedly, closing connection.

Normal FTP Client

When I connect with FTP Rush, I see something different.

[2][FTP]Status: Start Login dev-api.periplux.io ...
[2][FTP]Status: Connecting to 194.164.64.119:21
[2][FTP]Status: Text encoding: System.Text.UTF8Encoding
[2][FTP]Status: Login dev-api.periplux.io Successfully
[2][FTP]Status: Start List directory / ...
[2][FTP]Error: The specified data channel type is not implemented.

FTP Rush stays connected, but the directory contents don't come through.

Other GitHub Action

I started using SamKirkland/FTP-Deploy-Action because sebastianpopp/ftp-action would infinitely hang during this time without any feedback.

Recommendation

I would like the option to either detect this odd state where the directory contents is not being returned, or fail immediately if .ftp-deploy-sync-state.json is not on the server.

samuel-clara commented 3 months ago

Same here, FTP-Deploy-Action@v4.3.5 solves the issue!

Hexenon commented 3 months ago

having the same issue on my side, using FTP-Deploy-Action@v4.3.5,

  - name: Deploy to FTP server
    uses: SamKirkland/FTP-Deploy-Action@v4.3.5
    with:
      server: ${{ secrets.FTP_SERVER_TEST }}
      username: ${{ secrets.FTP_USERNAME_TEST }}
      password: ${{ secrets.FTP_PASSWORD_TEST }}
      local-dir: dist/
      server-dir: /
      log-level: verbose

i don't see any issue on the logs, it just says the file doesn't exists on the server. And it is there.

Hexenon commented 3 months ago

maybe we should get the error here if verbose ???

https://github.com/SamKirkland/ftp-deploy/blob/90398597732148985f6bf25c547eacc3d07aeef3/src/deploy.ts#L96

Hexenon commented 3 months ago

already created this PR, this way we can figure out why this isn't working.

https://github.com/SamKirkland/ftp-deploy/pull/41

Hexenon commented 3 months ago

@SamKirkland maybe can take a look and approve and bump versions... hehe?