argoproj / argoproj/notifications-engine

GitHub service incorrectly fails to fetch access token

Open
#205 3 comments 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
334
Forks
217
PR merge metrics
No merged PRs in 30d

Description

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". 😄

```console
$ 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
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=
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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the GitHub service path that fetches an installation access token and compare the behavior with the related issue #96. Reproduce the notification command against the shown endpoint, then verify that a successful token fetch is no longer rejected solely because the response is 302 Found.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, go
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.