Skip to content

GitHub service incorrectly fails to fetch access token聽#205

Open

Description

@lindhe

I'm getting an error when trying to trigger a GitHub commit status notification. It says it "received non 2xx response status". That, per se, is true! But it should not fail, because the status code is in fact just "302 Found". 馃槃

$ argocd -n argocd admin notifications template notify github-commit-status-success argocd --recipient 'github:'
DEBU[0000] Sending request: POST /app/installations/1/access_tokens HTTP/1.1
Host: git.example.com
Accept: application/vnd.github.v3+json
Accept: application/vnd.github.v3+json
Authorization: Bearer <redacted>
Content-Type: application/json

null  service=github
DEBU[0000] Received response: HTTP/2.0 302 Found
Connection: close
Cache-Control: no-cache
Content-Security-Policy: default-src 'none'; base-uri 'self'; block-all-mixed-content; child-src git.example.com/assets-cdn/worker/; connect-src 'self' git.example.com www.githubstatus.com online.visualstudio.com/api/v1/locations github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://git.example.com; font-src 'self'; form-action 'self' git.example.com; frame-ancestors 'none'; frame-src 'self'; img-src * data:; manifest-src 'self'; media-src git.example.com; script-src 'self'; style-src 'unsafe-inline' 'self'; worker-src git.example.com/assets-cdn/worker/
Content-Type: text/html; charset=utf-8
Date: Wed, 26 Jul 2023 12:52:42 GMT
Location: https://git.example.com/login?return_to=https%3A%2F%2Fgit.example.com%2Fapp%2Finstallations%2F1%2Faccess_tokens
Permissions-Policy: interest-cohort=()
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Server: GitHub.com
Set-Cookie: _fi_sess=<redacted>
Strict-Transport-Security: max-age=31536000; includeSubdomains
Vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Github-Request-Id: 38b6f266-036e-42aa-ac60-063e1d22536a
X-Runtime: 0.004097
X-Runtime-Rack: 0.008871
X-Xss-Protection: 0
  service=github
failed to notify 'github:': Post "https://git.example.com/api/v3/repos/foo/bar/statuses/99523bbf53929af04afd1295cbbebca81c18de09": could not refresh installation id 1's token: received non 2xx response status "302 Found" when fetching https://git.example.com/app/installations/1/access_tokens

Somewhat similar to #96.

Activity

  1. changed the title [-]GitHub serviced incorrectly fails to fetch access token[/-] [+]GitHub service incorrectly fails to fetch access token[/+] on Aug 16, 2023
  2. lindhe commented on Nov 15, 2023

    @lindhe
    ContributorAuthor
  3. lindhe commented on Nov 15, 2023

    @lindhe
    ContributorAuthor
  4. Cyanopus commented on Nov 15, 2023

    @Cyanopus

    Together with @lindhe we tried to add /api/v3 to the enterpriseBaseUrl and it workarounds the missing redirect handling on the bradleyfalzon/ghinstallation#98
    The following config(from chart values perspective) works:

    notifiers:
      service.github: |
        enterpriseBaseURL: https://<enterprise_url>/api/v3
        appID: xxx
        installationID: xxx
        privateKey: $github-privateKey
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions