SamKirkland / FTP-Deploy-Action

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

550 assets: No such file or directory #312

Open biel-correa opened 2 years ago

biel-correa commented 2 years ago

Bug Description I can't understand this error, I don't know what folder it's talking about. I'm using to deploy Angular. Note: My current ftp deploy folder is not empty

My Action Config

name: Deploy Front-end

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Node.js
        uses: actions/setup-node@v2
        with:
          node-version: 16

      - name: Install dependencies
        run: npm install
        working-directory: ./web

      - name: Run tests
        run: npm run test:headless
        working-directory: ./web

      - name: Build
        run: npm run build:prod
        working-directory: ./web

      - name: Deploy
        if: success()
        uses: SamKirkland/FTP-Deploy-Action@4.3.0
        with:
          local-dir: ./web/dist/web/
          server-dir: /home/website-name/www/
          server: ftp.my-website.net
          username: user
          password: ${{ secrets.FTP_FRONTEND_PASSWORD }}

My Action Log

Run SamKirkland/FTP-Deploy-Action@4.3.0

----------------------------------------------------------------
🚀 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 "/home/curriculos/www/.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:    14
Server Files:   0
----------------------------------------------------------------
Calculating differences between client & server
----------------------------------------------------------------
📁 Create: assets
📁 Create: assets/img
📁 Create: assets/styles
📄 Upload: 3rdpartylicenses.txt
📄 Upload: assets/img/logo.svg
📄 Upload: assets/styles/mixins.scss
📄 Upload: assets/styles/theme.scss
📄 Upload: favicon.ico
📄 Upload: index.html
📄 Upload: main.99ae500d4d3fed9f.js
📄 Upload: polyfills.7c01011[8](https://github.com/biel-correa/meucv/runs/7933357591?check_suite_focus=true#step:7:8)a34363[8](https://github.com/biel-correa/meucv/runs/7933357591?check_suite_focus=true#step:7:9)e.js
📄 Upload: runtime.557def03c21605fb.js
📄 Upload: scripts.013b4bc5d63100ec.js
📄 Upload: styles.c07e23c6744a6[9](https://github.com/biel-correa/meucv/runs/7933357591?check_suite_focus=true#step:7:10)ac.css
----------------------------------------------------------------
Making changes to 14 files/folders to sync server state
Uploading: 1.03 MB -- Deleting: 0 B -- Replacing: 0 B
----------------------------------------------------------------
creating folder "assets/"

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

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

FTPError: 550 assets: No such file or directory
    at FTPContext._onControlSocketData (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.3.0/dist/index.js:4774:39)
    at Socket.<anonymous> (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.3.0/dist/index.js:4615:44)
    at Socket.emit (events.js:314:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:268:11)
    at Socket.Readable.push (_stream_readable.js:213:[10](https://github.com/biel-correa/meucv/runs/7933357591?check_suite_focus=true#step:7:11))
    at TCP.onStreamRead (internal/stream_base_commons.js:[18](https://github.com/biel-correa/meucv/runs/7933357591?check_suite_focus=true#step:7:19)8:[23](https://github.com/biel-correa/meucv/runs/7933357591?check_suite_focus=true#step:7:24)) {
  code: 5[50](https://github.com/biel-correa/meucv/runs/7933357591?check_suite_focus=true#step:7:51)
}
Error: FTPError: [55](https://github.com/biel-correa/meucv/runs/7933357591?check_suite_focus=true#step:7:56)0 assets: No such file or directory
biel-correa commented 2 years ago

Today I tested with your npm package and it worked, the command I used was. ftp-deploy --server ftp.my-website.net --username user --password mypass --local-dir ./dist/web/ I ran it inside the web folder described in My Action Config's local-dir and worked just fine, after that I tryed running workflow without server-dir since the package worked but got the same error. One thing that I noticed is that the package created the file .ftp-deploy-sync-state.json but the workflow error still shows this message:

----------------------------------------------------------------
No file exists on the server "/home/curriculos/www/.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.
----------------------------------------------------------------
SamKirkland commented 2 years ago

@biel-correa can you view the server and tell me where your .ftp-deploy-sync-state.json file is located on the server?

biel-correa commented 2 years ago

@biel-correa can you view the server and tell me where your .ftp-deploy-sync-state.json file is located on the server?

it is inside www which is the folder filezilla opens right after login.

biel-correa commented 2 years ago

@SamKirkland is there a verbose config that I could use to view more details?

SamKirkland commented 2 years ago

You can set log-level to verbose

biel-correa commented 2 years ago

@SamKirkland I ran it like this now:

- name: Deploy
    if: success()
    uses: SamKirkland/FTP-Deploy-Action@4.3.0
    with:
        server: ftp.my-website.net
        username: user
        password: ${{ secrets.FTP_FRONTEND_PASSWORD }}
        local-dir: ./web/dist/web/
        server-dir: ./www/
        log-level: verbose

And got this:

----------------------------------------------------------------
🚀 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 ./web/dist/web/.ftp-deploy-sync-state.json
Local state created
Connected to 191.6.197.114:21 (No encryption)
< 220 ::ffff:191.6.197.114 FTP server ready

Login security: No encryption
> USER user
< 331 Password required for user

> PASS ###
< 230 User user logged in

> FEAT
< 550 FEAT: Operation not permitted

> TYPE I
< 200 Type set to I

> STRU F
< 200 Structure set to F

> OPTS UTF8 ON
< 200 UTF8 set to on

  changing dir to ./www/
> MKD .
< 550 .: Permission denied

> CWD .
< 550 .: No such file or directory

----------------------------------------------------------------
No file exists on the server "./www/.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:    14
Server Files:   0
----------------------------------------------------------------
Calculating differences between client & server
----------------------------------------------------------------
📁 Create: assets
📁 Create: assets/img
📁 Create: assets/styles
📄 Upload: 3rdpartylicenses.txt
📄 Upload: assets/img/logo.svg
📄 Upload: assets/styles/mixins.scss
📄 Upload: assets/styles/theme.scss
📄 Upload: favicon.ico
📄 Upload: index.html
📄 Upload: main.99ae500d4d3fed9f.js
📄 Upload: polyfills.7c010118a343638e.js
📄 Upload: runtime.557def03c21605fb.js
📄 Upload: scripts.013b4bc5d63100ec.js
📄 Upload: styles.c07e23c6744a69ac.css
----------------------------------------------------------------
Making changes to 14 files/folders to sync server state
Uploading: 1.03 MB -- Deleting: 0 B -- Replacing: 0 B
----------------------------------------------------------------
creating folder "assets/"
  changing dir to assets
> MKD assets
< 550 assets: Permission denied

> CWD assets

----------------------------------------------------------------
--------------  🔥🔥🔥 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/4.3.0/dist/index.js:4617:56)
    at Socket.emit (events.js:326:22)
    at endReadableNT (_stream_readable.js:[12](https://github.com/biel-correa/meucv/runs/7942912288?check_suite_focus=true#step:7:13)41:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:[21](https://github.com/biel-correa/meucv/runs/7942912288?check_suite_focus=true#step:7:22))

this command is trying to create a folder called . > MKD .

biel-correa commented 2 years ago

also tested with server-dir: www/, had the same error but it tries to create a folder called www instead of .

SamKirkland commented 2 years ago

It looks like you are getting permission errors. Can you see if you can increase the permissions on your FTP account?

biel-correa commented 2 years ago

I can't, if I connect with the same account on filezilla I can do anything. The permission error might be from a folder that I shouldn't even be in

biel-correa commented 2 years ago

@SamKirkland Is there any way off viewing pwd when it logs in to ftp?

rbalet commented 2 days ago

Hi @biel-correa @SamKirkland I'm coming back to this error again, as I just faced it today.

I've analysed it

This is the github action config

      - name: ⬆️ Upload ftp
        uses: SamKirkland/FTP-Deploy-Action@v4.3.5
        with:
          server: ${{ secrets.FTP_HOST }}
          username: ${{ secrets.FTP_USER }}
          password: ${{ secrets.FTP_PASSWORD }}
          local-dir: ./dist/my-website/
          server-dir: ./
          log-level: verbose

And this is what the library is doing

----------------------------------------------------------------
Calculating differences between client & server
----------------------------------------------------------------
📁 Create: browser
📄 Upload: 3rdpartylicenses.txt
📄 Upload: browser/.htaccess
📄 Upload: browser/.user.ini
📄 Upload: browser/chunk-3GFIK4GU.js
... // chunks
📄 Upload: browser/styles-56ZPM6VB.css
📁 Delete: my-website  

He does then get the problem by trying to delete the my-website

  file uploaded
removing folder "/my-website"
> PWD
< 257 "/" is the current directory

> CWD /my-website
< 550 /my-website: No such file or directory

Inside the ./dist/my-website folder we do have a browser file. image

Same over in the server image

So the upload does actually work as expected, but for some reason he's trying to remove the my-website which does not exists.

I've changed the default outputPath to point extra to that dist/my-website, as I'm working in an nx monorepo and i do have multiple website like dist/second-website, ....

This does seems to be due to that change in the outputPath, as it works just fine without the /my-website -> Aka. local-dir: ./dist/