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

neonctl fails any command when running in GitHub Actions context #305

Open
matthewmorek opened this issue Dec 16, 2024 · 7 comments
Open
Assignees

Comments

@matthewmorek
Copy link

matthewmorek commented Dec 16, 2024

Starting today, neonctl stopped working inside the GitHub runners context, despite me rotating API keys, removing/adding NeonDB GH integration, adding keys manually, ensure all required vars are available, etc.

For the sake of consistency, I tried the same commands locally in my terminal, using the same strategy of keeping NEON_API_KEY variable exported inside my environment, and the these commands worked as expected.

Could there be some blocking happening on the NeonDB side?

BTW, majority of my workflows run NeonDB's own GitHub Actions, such as:

The above all fail with the same eror, same as using neonctl directly.

Steps to reproduce

Add the following create_neon_branch workflow and run it via Pull Request

name: Preview

on:
  pull_request:
    types:
      - opened
      - reopened
      - synchronize
      - closed

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}

env:
  NEON_DATABASE_USERNAME: ${{ vars.PG_USERNAME }}
  NEON_DATABASE_NAME: ${{ vars.PG_DATABASE }}
  GH_TOKEN: ${{ secrets.GH_TOKEN }}
  NEON_API_KEY: ${{ secrets.NEON_API_KEY }}
  NEON_PROJECT_ID: ${{ vars.NEON_PROJECT_ID }}

jobs:
  setup:
    name: Setup
    outputs:
      branch: ${{ steps.branch_name.outputs.current_branch }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Get branch name
        id: branch_name
        uses: tj-actions/branch-names@v8

  create-branch:
    name: Create Neon DB branch
    needs: setup
    outputs:
      db_url_with_pooler: ${{ steps.create-branch.outputs.db_url_with_pooler }}
      branch_id: ${{ steps.create-branch.outputs.branch_id }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v4
        with:
          run_install: false

      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: "pnpm"

      - name: Create Neon Branch
        id: create-branch
        uses: neondatabase/create-branch-action@v5
        with:
          project_id: ${{ env.NEON_PROJECT_ID }}
          # parent: dev # optional (defaults to your primary branch)
          branch_name: preview/pr-${{ github.event.number }}-${{ needs.setup.outputs.branch }}
          username: ${{ env.NEON_DATABASE_USERNAME }}
          database: ${{ env.NEON_DATABASE_NAME }}
          api_key: ${{ env.NEON_API_KEY }}

Expected result

Expected to have db_url_with_pooler and branch_id available and successful job completion

Actual result

Warning: Can't add secret mask for empty string in ##[add-mask] command.
branch create out:
branch create err:
ERROR: The request could not be authorized due to an internal error
ERROR: branch creation failed
ERROR: The request could not be authorized due to an internal error
Error: Process completed with exit code 1.

Environment

node: v22.12.0
npm: 10.9.0
yarn: 1.22.22

Logs, links

@duskpoet
Copy link
Member

Hey! Thanks for reporting!
There was a problem on our side. Can you try again now, please?

@fabuzaid21
Copy link

FWIW, I'm having the exact same issue. I just tried it again, but it's still not working. The Neon API, however, is working for me.

@matthewmorek
Copy link
Author

Mine just went through successfully, thanks for sorting this out!

I would love to get more meaningful error messages from the CLI though, since I though it's my API that was the problem, so I rotated the key everywhere as a result, which wasn't very optimal.

@fabuzaid21
Copy link

Hmmm I'm still having a problem, @duskpoet. I'm running these from CircleCI, not GH Actions. Could that be the issue?

@duskpoet
Copy link
Member

Mine just went through successfully, thanks for sorting this out!

I would love to get more meaningful error messages from the CLI though, since I though it's my API that was the problem, so I rotated the key everywhere as a result, which wasn't very optimal.

Yea, sorry, we had a misnatch between api and our api client

@duskpoet
Copy link
Member

Hmmm I'm still having a problem, @duskpoet. I'm running these from CircleCI, not GH Actions. Could that be the issue?

not sure, maybe something is cached?

@duskpoet
Copy link
Member

Can you, please, confirm that issue is resolved, @fabuzaid21 ? I am not familiar with CircleCI at all :(

@rumyantseva rumyantseva self-assigned this Dec 17, 2024
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

4 participants