Bug Description
Right now, if any internal fetch() rejects due to a network/runtime error, the whole route fails after the rate limit has already been consumed.
You currently handle res.ok === false, but not thrown fetch errors or invalid JSON.
Steps to Reproduce
const [contributionsRaw, prsRaw, streakRaw, reposRaw] = await Promise.all([
fetchJsonOrEmpty(
${baseUrl}/api/metrics/contributions?days=90,
headers
),
fetchJsonOrEmpty(
${baseUrl}/api/metrics/prs,
headers
),
fetchJsonOrEmpty(
${baseUrl}/api/metrics/streak,
headers
),
fetchJsonOrEmpty(
${baseUrl}/api/metrics/repos?days=90,
headers
),
]);
This prevents one broken metrics endpoint from killing the entire insight route.
Affected Area
API Routes
Screenshots
No response
Browser & OS
No response
Environment
None
Additional Context
No response
Bug Description
Right now, if any internal
fetch()rejects due to a network/runtime error, the whole route fails after the rate limit has already been consumed.You currently handle
res.ok === false, but not thrown fetch errors or invalid JSON.Steps to Reproduce
const [contributionsRaw, prsRaw, streakRaw, reposRaw] = await Promise.all([
fetchJsonOrEmpty(
${baseUrl}/api/metrics/contributions?days=90,headers
),
fetchJsonOrEmpty(
${baseUrl}/api/metrics/prs,headers
),
fetchJsonOrEmpty(
${baseUrl}/api/metrics/streak,headers
),
fetchJsonOrEmpty(
${baseUrl}/api/metrics/repos?days=90,headers
),
]);
This prevents one broken metrics endpoint from killing the entire insight route.
Affected Area
API Routes
Screenshots
No response
Browser & OS
No response
Environment
None
Additional Context
No response