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

Error: Error: EACCES: permission denied, open './_site/.ftp-deploy-sync-state.json'

Open ukutaht opened this issue 2 years ago • 4 comments

Bug Description

I am trying to upload a jekyll site to BunnyCDN over FTP. I started with the following configuration:

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

Full configuration here

This configuration does not successfully upload the files, instead it throws the following error:

Error: Error: EACCES: permission denied, open './_site/.ftp-deploy-sync-state.json'

Full build log here

Workaround

I tried using the workaround mentioned in https://github.com/SamKirkland/FTP-Deploy-Action/issues/146 that adds the following configuration:

state-name: ../.ftp-deploy-sync-state.json

Unfortunately this doesn't work for me either. The build gets much further but times out at the end when it tries to save the state file:

Error: Timeout (control socket)
    at Socket.<anonymous> (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.2.0/dist/index.js:4778:58)
    at Object.onceWrapper (events.js:299:28)
    at Socket.emit (events.js:210:5)
    at Socket._onTimeout (net.js:469:8)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7)
Error: Error: Timeout (control socket)

Full build log [here](https://github.com/plausible/website/runs/4813302224?check_suite_focus=true0 I can confirm this is not an isolated failure, the timeout happens predictably every time.

Any ideas how to fix this?

ukutaht avatar Jan 14 '22 14:01 ukutaht

I have the same Issue, I try to deploy an WebGL Unity build to an FTP server and same error

TheoGimenez7 avatar Jan 20 '22 19:01 TheoGimenez7

+1

artursopelnik avatar Mar 18 '22 17:03 artursopelnik

+1

ErcinDedeoglu avatar Jan 08 '23 15:01 ErcinDedeoglu

I suppose this is not really an FTP-Deploy-Action issue. The action needs to be able to write the .ftp-deploy-sync-state.json inside the folder you want to upload; and the error indicates it does not have the correct ownership on that folder to do that.

In my case, the folder did not even exist in my repo: it was created in the Action in a previous step. That step was running a docker container, and the folder was created in a volume mounted to that container. I ran ls -hal . before my FTP-Deploy-Action step, and sure enough, anything that was created via the docker container required root privilege, whereas anything that was checked out from the repo was accessible to the runner user.

To solve the problem on my end, it was sufficient to run mkdir $folderName just after the checkout step (where $folderName is the name of the folder I wanted to upload). This ensured the folder already existed and had the right ownership requirements before it was created by the other process.

Each case might be a little different, but in the end it is about ensuring that the runner user can write files inside the folder you want to upload.

olivergrabinski avatar Apr 02 '23 18:04 olivergrabinski