N
Neon6mo ago
sensitive-blue

Neon Database Branch Deletion Issue in GitHub Actions

I'm facing a permission issue with Neon Database branch deletion in my GitHub Actions workflow. The API key works for listing projects but fails when trying to delete branches. The Error

ERROR: user has no access to projects
Error: Process completed with exit code 1.

ERROR: user has no access to projects
Error: Process completed with exit code 1.

My Workflow

- name: Delete Neon Branch
uses: neondatabase/delete-branch-action@v3.1.3
with:
project_id: ${{ secrets.NEON_PROJECT_ID }}
branch: preview/pr-8-preview
api_key: ${{ secrets.NEON_API_KEY }}

- name: Delete Neon Branch
uses: neondatabase/delete-branch-action@v3.1.3
with:
project_id: ${{ secrets.NEON_PROJECT_ID }}
branch: preview/pr-8-preview
api_key: ${{ secrets.NEON_API_KEY }}

Debugging Steps I can successfully list projects:

- name: Verify API Access
run: neonctl projects list
env:
NEON_API_KEY: ${{ secrets.NEON_API_KEY }}

- name: Verify API Access
run: neonctl projects list
env:
NEON_API_KEY: ${{ secrets.NEON_API_KEY }}
` 
Output shows I can see all projects:

Projects
┌───────────────────────────┬───────────────────┬──────────────────┬──────────────────────┐
│ Id │ Name │ Region Id │ Created At │
├───────────────────────────┼───────────────────┼──────────────────┼──────────────────────┤
│ *** │ growtools │ aws-eu-central-1 │ 2025-04-09T09:27:21Z │
├───────────────────────────┼───────────────────┼──────────────────┼──────────────────────┤
│ empty-forest-81403208 │ turbo-boilerplate │ aws-eu-central-1 │ 2025-03-26T17:34:26Z │
...

Projects
┌───────────────────────────┬───────────────────┬──────────────────┬──────────────────────┐
│ Id │ Name │ Region Id │ Created At │
├───────────────────────────┼───────────────────┼──────────────────┼──────────────────────┤
│ *** │ growtools │ aws-eu-central-1 │ 2025-04-09T09:27:21Z │
├───────────────────────────┼───────────────────┼──────────────────┼──────────────────────┤
│ empty-forest-81403208 │ turbo-boilerplate │ aws-eu-central-1 │ 2025-03-26T17:34:26Z │
...
`
 Interestingly, the ID for my growtools project is redacted (***) while other project IDs are visible, suggesting the API key might have different permission levels for different projects. I've tried creating new API keys with admin permissions but still get the same error. Any ideas on how to properly configure an API key with branch deletion permissions specifically for this project?
1 Reply
sunny-green
sunny-green6mo ago
Is the project that you're trying to delete branches from owned by an Neon organization? In that case, it might be that you need an organization API key: https://neon.tech/docs/manage/api-keys But maybe you've tried that already. Note that when using the Neon CLI with org-owned projects, you can specify the --org-id option for access to projects in the org. https://neon.tech/docs/reference/cli-projects#options And make sure you're running the latest Neon CLI. https://neon.tech/docs/reference/cli-install#upgrade

Did you find this page helpful?