Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow fails with EACCES: permission denied, open '/home/runner/work/../... #89

Open
KamaniBhavin opened this issue Jun 1, 2023 · 2 comments

Comments

@KamaniBhavin
Copy link

KamaniBhavin commented Jun 1, 2023

I have a GitHub workflow that utilizes two actions: cloudflare/wrangler-action@2.0.0 and cloudflare/pages-action@v1. However, these actions are not functioning as expected.

name: Deploy 

on:
  push:
    branches:
      - main
        
jobs:
  deploy:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      deployments: write
    name: Deploy SIYA
    env:
      SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
      DATABASE_URL: ${{ secrets.DATABASE_URL }}
      
    steps:
      - uses: actions/checkout@v2
        
      - name: Restore cache
        id: restore-cache
        uses: actions/cache@v2
        with:
          path: node_modules
          key: ${{ runner.os }}-restore-cache-${{ hashFiles('package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-restore-cache-
          
      - name: Install dependencies
        id: install-dependencies
        if: steps.restore-cache.outputs.cache-hit != 'true'
        run: |
          npm run setup
        
      - name: Deploy Slack bot
        id: deploy-slack-bot
        uses: cloudflare/wrangler-action@2.0.0
        with:
          wranglerVersion: '3.0.0'
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          workingDirectory: packages/slack-bot
          command: deploy
          secrets: |
            DATABASE_URL
            SLACK_CLIENT_SECRET
            SLACK_SIGNING_SECRET
            SENTRY_DSN
        env:
          SLACK_CLIENT_SECRET: ${{ secrets.SLACK_CLIENT_SECRET }}
          SLACK_SIGNING_SECRET: ${{ secrets.SLACK_SIGNING_SECRET }}
            
      - name: Cache Siya site
        id: cache-siya-site
        uses: actions/cache@v2
        with:
          path: packages/siya-site/build
          key: ${{ runner.os }}-cache-siya-site-${{ hashFiles('packages/siya-site/src/**') }}-${{ hashFiles('packages/siya-site/public/**') }}
          restore-keys: |
            ${{ runner.os }}-cache-siya-site-
            
      - name: Build Siya site
        id: build-siya-site
        if: steps.cache-siya-site.outputs.cache-hit != 'true'
        run: |
          cd packages/siya-site
          npm run build
          chmod 777 /home/runner/work/siya/siya/node_modules/
          
      - name: Deploy Siya site
        id: deploy-site
        uses: cloudflare/pages-action@v1
        with: 
          wranglerVersion: '3'
          projectName: siya-site
          branch: main
          directory: packages/siya-site/build
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          githubToken: ${{ secrets.GITHUB_TOKEN }}     

The workflow above encounters an error message stating "EACCES: permission denied, open '/home/runner/work/siya/siya/node_modules/.cache/wrangler/pages.json'."

Here is the error message screenshot:

Screenshot 2023-06-01 at 12 10 05 PM

An attempt was made to resolve the issue by using the command chmod -R 777 /home/runner/work/siya/siya/node_modules/.cache, but it resulted in an error message stating "operation not allowed."

Here is the screenshot of the error message:

Screenshot 2023-06-01 at 12 19 38 PM

Although it deploy the static asset to pages, but fails the workflow. If someone could assist in understanding the problem and provide a fix or workaround, it would be greatly appreciated.

@lovette
Copy link

lovette commented Jul 20, 2024

I'm surprised to see that this issue is a year old. I'm also getting the same error with pages-action@v1, but only when wranglerVersion is 3. The workflow runs fine if I don't set wranglerVersion.

Run cloudflare/pages-action@v1
npm warn exec The following package was not found and will be installed: wrangler@3.65.0
npm warn deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
npm warn deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
▲ [WARNING] `wrangler pages publish` is deprecated and will be removed in the next major version.
Please use `wrangler pages deploy` instead, which accepts exactly the same arguments.
▲ [WARNING] Warning: Your working directory is a git repo and has uncommitted changes
To silence this warning, pass in --commit-dirty=true
✘ [ERROR] EACCES: permission denied, mkdir '/home/runner/work/myproject2x/myproject2x/docs/site/.wrangler/tmp'
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose
? Would you like to report this error to Cloudflare?
🤖 Using fallback value in non-interactive context: no
🪵  Logs were written to "/home/runner/.config/.wrangler/logs/wrangler-2024-07-19_14-25-45_272.log"
npm notice
npm notice New minor version of npm available! 10.7.0 -> 10.8.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.2
npm notice To update run: npm install -g npm@10.8.2
npm notice
EXIT WHEN NOT EXPECTED
SHELLAC COMMAND FAILED!
Executing: npx wrangler@3 pages publish "." --project-name="myproject-internal-docs" --branch="" in /home/runner/work/myproject2x/myproject2x/docs/site
node:internal/process/promises:289
			triggerUncaughtException(err, true /* fromPromise */);
			^
[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<Object>".] {
code: 'ERR_UNHANDLED_REJECTION'
}
Node.js v20.13.1
STDOUT:
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose
? Would you like to report this error to Cloudflare?
🤖 Using fallback value in non-interactive context: no
STDERR:
npm warn exec The following package was not found and will be installed: wrangler@3.65.0
npm warn deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
npm warn deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
▲ [WARNING] `wrangler pages publish` is deprecated and will be removed in the next major version.
Please use `wrangler pages deploy` instead, which accepts exactly the same arguments.
▲ [WARNING] Warning: Your working directory is a git repo and has uncommitted changes
To silence this warning, pass in --commit-dirty=true
✘ [ERROR] EACCES: permission denied, mkdir '/home/runner/work/myproject2x/myproject2x/docs/site/.wrangler/tmp'
🪵  Logs were written to "/home/runner/.config/.wrangler/logs/wrangler-2024-07-19_14-25-45_272.log"
npm notice
npm notice New minor version of npm available! 10.7.0 -> 10.8.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.2
npm notice To update run: npm install -g npm@10.8.2
npm notice

My step options are straightforward.

- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
  wranglerVersion: '3'
  accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID}}
  apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN}}
  projectName: myproject-internal-docs
  workingDirectory: ./docs/site
  directory: .

@lovette
Copy link

lovette commented Jul 20, 2024

I just happened to stumble across a solution to my particular issue. No clue the root cause though.

The steps before I invoke pages-action include docker.

- name: Build mkdocs container image
  working-directory: ./docs
  run: docker build -t mkdocs .

- name: Build docs
  run: docker run --rm -v ./docs:/docs mkdocs build

If I simply replace docker with podman the EACCES errors go away and my workflow finishes successfully!

Now, if someone could make time to release pages-action@v2 I can silence the last remaining warning.

[WARNING] `wrangler pages publish` is deprecated and will be removed in the next major version.
Please use `wrangler pages deploy` instead, which accepts exactly the same arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants