supabase / setup-cli

A GitHub action for interacting with your Supabase projects using the CLI.
MIT License
113 stars 16 forks source link

cli fails in self-hosted github action runner #288

Open Jayllyz opened 4 months ago

Jayllyz commented 4 months ago

Describe the bug supabase db push not ending correctly in github actions v23.10 (self-hosted ubuntu vps runner)

To Reproduce Steps to reproduce the behavior:

env:
  SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_PROJECT_ID }}
  SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
  SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_PASSWORD }}

...

  - if: github.ref == 'refs/heads/main'
    name: Setup Supabase CLI
    uses: supabase/setup-cli@v1
    with:
      version: latest

  - if: github.ref == 'refs/heads/main'
    name: Deploy migrations
    run: 
      |
      supabase link --project-ref ${{ env.SUPABASE_PROJECT_ID }}
      supabase db push -p ${{ env.SUPABASE_DB_PASSWORD }}

Expected behavior A clear and concise description of what you expected to happen.

Return success exit code

Screenshots

image

System information Rerun the failing command with --create-ticket flag.

Additional context If applicable, add any other context about the problem here.

sweatybridge commented 4 months ago

The link and push commands seem to have succeeded based on your logs. You can verify by adding echo $? to the run step, for eg.

    run: |
      supabase link --project-ref ${{ env.SUPABASE_PROJECT_ID }}
      supabase db push -p ${{ env.SUPABASE_DB_PASSWORD }}
      echo $?

Are you able to check the output of 7c5ad7cb-...f46e.sh? Perhaps the error originated from line 2 of that file: X4T: command not found.

Jayllyz commented 4 months ago

I tried to check before creating my issue what was in this bash file, but as it's in a temporary folder, when the action finishes, it's deleted.

Yes, the command looks to be successful.

Raw logs with echo $? added:

2024-05-21T12:50:32.9819523Z shell: /usr/bin/bash -e {0}
2024-05-21T12:50:32.9820012Z env:
2024-05-21T12:50:32.9820491Z   SUPABASE_PROJECT_ID: ***
2024-05-21T12:50:32.9821228Z   SUPABASE_ACCESS_TOKEN: ***
2024-05-21T12:50:32.9821776Z   SUPABASE_DB_PASSWORD: ***
2024-05-21T12:50:32.9822705Z   PNPM_HOME: /home/jayllyz/setup-pnpm/node_modules/.bin
2024-05-21T12:50:32.9823432Z   SUPABASE_INTERNAL_IMAGE_REGISTRY: ghcr.io
2024-05-21T12:50:32.9824112Z ##[endgroup]
2024-05-21T12:50:33.5064049Z Connecting to remote database...
2024-05-21T12:50:33.8197391Z Failed to save database password: failed to set credentials: The name org.freedesktop.secrets was not provided by any .service files
2024-05-21T12:50:33.8199704Z Finished supabase link.
2024-05-21T12:50:33.8254893Z /home/jayllyz/github/actions-runner/_work/_temp/57d66976-2d57-4bc7-ab93-618cbec0e12c.sh: line 2: X4T: command not found
2024-05-21T12:50:33.8848769Z Connecting to remote database...
2024-05-21T12:50:34.1538417Z Remote database is up to date.
2024-05-21T12:50:34.1582786Z ##[error]Process completed with exit code 127.
jasurabdullin commented 3 months ago

Having the same issue. Any updates on this yet?

sweatybridge commented 3 months ago

@jasurabdullin can you run the following in your self-hosted runner and report the logs? Remember to redact any sensitive information.

    run: |
      set -x
      supabase link --project-ref ${{ env.SUPABASE_PROJECT_ID }}
      supabase db push -p ${{ env.SUPABASE_DB_PASSWORD }}
      echo "exit code: $?"
Jayllyz commented 3 months ago

removed password ofc this

Failure also occurs when some migrations need to be pushed:

image

The migrations are being pushed successfully, so I'm using continue-on-error: true as a workaround for now.

sweatybridge commented 3 months ago

As shown on line 18, something on your runner is trying to execute X4T. I don't know what that program is but it seems like something added by action runner itself and not supabase cli.

Can you try separate run steps to see if it works?

    - run: supabase link --project-ref ${{ env.SUPABASE_PROJECT_ID }}
    - run: supabase db push -p ${{ env.SUPABASE_DB_PASSWORD }}
Jayllyz commented 3 months ago

As shown on line 18, something on your runner is trying to execute X4T. I don't know what that program is but it seems like something added by action runner itself and not supabase cli.

Can you try separate run steps to see if it works?

    - run: supabase link --project-ref ${{ env.SUPABASE_PROJECT_ID }}
    - run: supabase db push -p ${{ env.SUPABASE_DB_PASSWORD }}

Same results, X4T is being executed right before supabase db push then fail with exit code 127. link exit with exit code 0.