Skip to content

Commit 7a25dd3

Browse files
committed
fix: consider 401 errors as trasient
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
1 parent 53e5262 commit 7a25dd3

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

services/apps/packages_worker/src/enricher/fetchActivitySnapshot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async function graphqlRequest<T>(
4646
const resetSec = parseInt(response.headers.get('x-ratelimit-reset') ?? '0', 10)
4747
const resetMs = resetSec ? resetSec * 1000 + 5_000 : Date.now() + 65_000
4848

49-
if (response.status === 401) throw new FetchError('AUTH', '401 Unauthorized')
49+
if (response.status === 401) throw new FetchError('TRANSIENT', '401 Unauthorized')
5050
if (response.status === 403) {
5151
const body = await response.text()
5252
if (body.toLowerCase().includes('rate limit'))

services/apps/packages_worker/src/enricher/fetchLightRepo.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ export async function fetchLightRepo(
146146
const resetSec = parseInt(response.headers.get('x-ratelimit-reset') ?? '0', 10)
147147
const resetMs = resetSec ? resetSec * 1000 + 5_000 : Date.now() + 65_000
148148

149-
if (response.status === 401) throw new FetchError('AUTH', `401 Unauthorized for ${url}`)
149+
// 401 is requester/platform-side (bad token, GitHub auth incident) — never a repo signal
150+
if (response.status === 401) throw new FetchError('TRANSIENT', `401 Unauthorized for ${url}`)
150151

151152
if (response.status === 403) {
152153
const body = await response.text()

0 commit comments

Comments
 (0)