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

GitHub service incorrectly fails to fetch access token #205

Open
lindhe opened this issue Jul 26, 2023 · 3 comments
Open

GitHub service incorrectly fails to fetch access token #205

lindhe opened this issue Jul 26, 2023 · 3 comments

Comments

@lindhe
Copy link
Contributor

lindhe commented Jul 26, 2023

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.

@lindhe lindhe changed the title GitHub serviced incorrectly fails to fetch access token GitHub service incorrectly fails to fetch access token Aug 16, 2023
@lindhe
Copy link
Contributor Author

lindhe commented Nov 15, 2023

@lindhe
Copy link
Contributor Author

lindhe commented Nov 15, 2023

Related to bradleyfalzon/ghinstallation#98

@Cyanopus
Copy link

Cyanopus commented Nov 15, 2023

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants