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

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

Open teamITGoldenEnglish opened this issue 10 months ago • 6 comments

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: - master name: 🚀 Deploy to Production on push jobs: web-deploy: name: 🎉 Deploy runs-on: ubuntu-latest steps: - name: 🚚 Get latest code uses: actions/checkout@v3

- name: 📂 Sync files
  uses: SamKirkland/[email protected]
  with:
    server: ${{ secrets.FTP_SERVER }}
    username: ${{ secrets.FTP_USERNAME }}
    password: ${{ secrets.FTP_PASSWORD }}
    

Action Log: 🚀 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

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: 2,656 Server Files: 0


-------------- 🔥🔥🔥 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.

teamITGoldenEnglish avatar Mar 28 '24 19:03 teamITGoldenEnglish

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
----------------------------------------------------------------
  • My server has many files.
  • My server has .ftp-deploy-sync-state.json
  • This was working just fine a few minutes ago
  • No configuration changes

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.

lewismoten avatar Jun 08 '24 06:06 lewismoten

Same here, [email protected] solves the issue!

samuel-clara avatar Aug 26 '24 15:08 samuel-clara

having the same issue on my side, using [email protected],

  - name: Deploy to FTP server
    uses: SamKirkland/[email protected]
    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 avatar Aug 27 '24 07:08 Hexenon

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

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

Hexenon avatar Aug 27 '24 07:08 Hexenon

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

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

Hexenon avatar Aug 27 '24 07:08 Hexenon

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

Hexenon avatar Aug 27 '24 07:08 Hexenon