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

🐛 BUG: ERROR: Must specify a directory. #3706

Closed
arnonrdp opened this issue Aug 3, 2023 · 7 comments
Closed

🐛 BUG: ERROR: Must specify a directory. #3706

arnonrdp opened this issue Aug 3, 2023 · 7 comments
Labels
bug Something that isn't working

Comments

@arnonrdp
Copy link

arnonrdp commented Aug 3, 2023

Which Cloudflare product(s) does this pertain to?

Workers for Platforms, Workers Runtime, Wrangler core

What version(s) of the tool(s) are you using?

Latest

What version of Node are you using?

18.16.1

What operating system are you using?

Mac

Describe the Bug

Guys, I'm getting this error (Must specify a directory) when running a GitHub Action in order to Deploy a repository on CloudFlare Worker.

In the documentation, I didn't find anything regarding specifying a directory.

Could someone tell me where and how I report this?


This is my wrangler.toml:

name = "sparkling-paper-3924"
main = "src/worker.js"
compatibility_date = "2023-08-01"
account_id = "febb3b25d5ad9fea8d9db175fe2c3477"

This is my .github/workflows/deploy.yml:

name: Deploy to Cloudflare

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    name: Deploy
    steps:
      - uses: actions/checkout@v3
      - name: Setup Node.js 16
        uses: actions/setup-node@v3
        with:
          node-version: 16
          cache: 'npm'

      - name: Install dependencies
        run: npm install
      - name: Deploy
        uses: cloudflare/wrangler-action@2.0.0
        with:
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          command: pages deploy --project-name=sparkling-paper-3924

Please provide a link to a minimal reproduction

https://github.com/globe-and-citizen/sparkling-paper-3924

Please provide any relevant error logs

Captura de Tela 2023-08-03 às 15 55 18
@arnonrdp arnonrdp added the bug Something that isn't working label Aug 3, 2023
@Cherry
Copy link
Contributor

Cherry commented Aug 6, 2023

command: pages deploy --project-name=sparkling-paper-3924

Are you trying to deploy to Cloudflare Pages, or Cloudflare Workers? For Pages, pages deploy expects a directory of static assets, commonly like dist or public. Pages also doesn't use a wrangler.toml.

For Workers, which it appears you're trying to do as per your example at https://github.com/globe-and-citizen/Sample-Node-Server, you want to use simply deploy as your command in wrangler-action.

@arnonrdp
Copy link
Author

arnonrdp commented Aug 7, 2023

Thanks!! Worked!

@arnonrdp arnonrdp closed this as completed Aug 7, 2023
@mklueh
Copy link

mklueh commented Mar 10, 2024

Will pages support a toml file in future?

I'm using Nx to deploy multiple projects, and I'd like to have the specific project configurations within the project itself while having the deployment script at the root of the project (top-level setup regarding branches / environments).

@Suman085
Copy link

Suman085 commented Apr 10, 2024

I am getting the same issue when i am trying to deploy pages. How do i specify a directory?
` deploy:
runs-on: ubuntu-latest
name: Deploy
needs: build

steps:
  - name: Download artifact
    uses: actions/download-artifact@v2
    with:
      name: build
      path: ./build

  - name: Deploy to Cloudflare
    uses: cloudflare/wrangler-action@v3.4.1
    with:
      apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
      accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
      command: pages deploy --project-name=dokku

`

Run cloudflare/wrangler-action@v3.4.1
📥 Installing Wrangler
🚀 Running Wrangler Commands
/usr/local/bin/npx wrangler pages deploy --project-name=dokku

✘ [ERROR] Must specify a directory.

If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose
Error: The process '/usr/local/bin/npx' failed with exit code 1
Error: 🚨 Action failed

@Suman085
Copy link

I am getting the same issue when i am trying to deploy pages. How do i specify a directory? ` deploy: runs-on: ubuntu-latest name: Deploy needs: build

steps:
  - name: Download artifact
    uses: actions/download-artifact@v2
    with:
      name: build
      path: ./build

  - name: Deploy to Cloudflare
    uses: cloudflare/wrangler-action@v3.4.1
    with:
      apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
      accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
      command: pages deploy --project-name=dokku

`

Run cloudflare/wrangler-action@v3.4.1 📥 Installing Wrangler 🚀 Running Wrangler Commands /usr/local/bin/npx wrangler pages deploy --project-name=dokku

✘ [ERROR] Must specify a directory.

If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose Error: The process '/usr/local/bin/npx' failed with exit code 1 Error: 🚨 Action failed

Simply fixed it by updating my command pages deploy artifact-folder --project-name=dokku

1 similar comment
@Suman085
Copy link

I am getting the same issue when i am trying to deploy pages. How do i specify a directory? ` deploy: runs-on: ubuntu-latest name: Deploy needs: build

steps:
  - name: Download artifact
    uses: actions/download-artifact@v2
    with:
      name: build
      path: ./build

  - name: Deploy to Cloudflare
    uses: cloudflare/wrangler-action@v3.4.1
    with:
      apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
      accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
      command: pages deploy --project-name=dokku

`

Run cloudflare/wrangler-action@v3.4.1 📥 Installing Wrangler 🚀 Running Wrangler Commands /usr/local/bin/npx wrangler pages deploy --project-name=dokku

✘ [ERROR] Must specify a directory.

If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose Error: The process '/usr/local/bin/npx' failed with exit code 1 Error: 🚨 Action failed

Simply fixed it by updating my command pages deploy artifact-folder --project-name=dokku

@ryanflorence
Copy link

ryanflorence commented Jun 12, 2024

The CLI from my local machine supports the toml file:

wrangler pages deploy

wrangler.toml

pages_build_output_dir = "./public"

But the GitHub action doesn't

# other stuff
command: pages deploy

Seems weird cause it's the same command?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working
Projects
None yet
Development

No branches or pull requests

5 participants