Maintainer repository sync always fails: GitHubSyncPanel POSTs to /api/github/sync/:owner/:repo, which this app does not serve
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- github, next.js, typescript
- Ambito
- api, authentication, frontend
Direzione di ricerca
Start with src/app/dashboard/maintainer/GitHubSyncPanel.tsx and the shared request helpers in src/lib/api.ts; confirm the backend sync path and pagination fields before choosing the request URL. Check the existing API call patterns and add focused coverage for the panel’s request origin, authentication, pagination stopping, and 404 message. Done when repository sync reaches the authenticated backend, can be stopped or terminates safely, and reports endpoint failures clearly.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Location
src/app/dashboard/maintainer/GitHubSyncPanel.tsx:40-46
Problem
The "Connect repository" panel syncs a repo's issues with:
const url = `/api/github/sync/${encodeURIComponent(owner.trim())}/${encodeURIComponent(repo.trim())}${params.toString() ? `?${params}` : ""}`;
const res = await fetch(url, { method: "POST" });
if (!res.ok) {
const body = await res.json().catch(() => ({}));
throw new Error(body.error || `Sync failed (${res.status})`);
}
The URL is relative, so it targets the Next.js app's own origin. Nothing in this repository serves it:
- The only Route Handler under
src/app/issrc/app/sitemaps/[id]/route.ts; there is nosrc/app/api/directory. next.config.tshas norewrites(), so/api/*is not proxied toNEXT_PUBLIC_API_URL.
Every sync attempt therefore gets the Next.js HTML 404. res.json() on an HTML body rejects, the .catch(() => ({})) swallows it, body.error is undefined, and the panel shows the generic Sync failed (404).
Two further problems in the same call, which will matter once the URL is corrected:
- No credentials. The request sends no
Authorizationheader and no token, unlike every other mutating call in the app, which goes throughapiPost/apiRequestinsrc/lib/api.ts. Syncing a repository is a per-maintainer, authenticated action, so pointing this at the real backend as written would get a 401 rather than a 404. - Unbounded pagination loop. Lines 36-51 loop
do { ... } while (nextPage)with no iteration cap and noAbortController. A backend that keeps returning the samenextPagecursor — or one that echoes a cursor on an error response — spins forever, firing requests with no way for the user to cancel, since the panel has no stop control.
Why it matters
Repository sync is the entry point for the entire maintainer workflow: src/app/dashboard/maintainer/page.tsx:110 renders an "No repositories connected" empty state until fetchMyRepositories returns something, and the pipeline board stays empty until then. With this call 404ing, a maintainer can never get their issues onto the platform, which is the problem closed issue #637 ("No UI to sync a GitHub repository, so maintainers can't bring their issues onto the platform") was closed on — so #637 has regressed: the UI exists but is wired to a nonexistent endpoint.
The error text also misdirects whoever debugs it. "Sync failed (404)" reads as "that repository does not exist on GitHub", not "this app has no such endpoint".
Reproduction
- Sign in as a maintainer and open
/dashboard/maintainer. - In the "Connect repository" panel, enter any owner and repo (e.g.
stellar/soroban-examples) and click Sync. - DevTools → Network:
POST http://localhost:3000/api/github/sync/stellar/soroban-examplesreturns 404 withcontent-type: text/html. - The panel renders
Sync failed (404)andsyncedReposstays empty.
Suggested fix
- Route the call through the shared API client so it targets
NEXT_PUBLIC_API_URLand carries the session token: useapiPostfromsrc/lib/api.ts(which already handles the token, the timeout/AbortController, and rate-limit/error parsing) instead of a barefetch. Confirm the backend's actual sync path and its pagination field names before settling on the URL shape. - Alternatively add a real
src/app/api/github/sync/[owner]/[repo]/route.tshandler that forwards to the backend server-side; if you do, it must read the session itself rather than trusting the client. - Cap the pagination loop (for example, stop after N pages or when a
nextPagecursor repeats) and thread anAbortControllerthrough it so navigating away or clicking a cancel control stops the run. - Distinguish a 404 on the endpoint from a 404 on the repository in the message, so the two failures are not reported with identical copy.
- Add a test for this panel that asserts the request goes to the configured API origin and that a 404 surfaces a specific message; there is currently no
GitHubSyncPanel.test.tsxat all.
- Lingua principale
- TypeScript
- Stelle
- 1
- Fork
- 94
- Merge medio
- 1h 2m
- PR unite (30g)
- 25
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di MergeFi/frontend
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
bug testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
accessibility bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
MergeFi/frontend#835 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di MergeFi/frontend
Issue simili
-
ログイン中の404画面にヘッダーとナビを出すApertaCodex使用可 コード
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ryuki-moro/Nicomaru#218 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
sveltejs/svelte-eslint-parser#1008 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
silverbucket/inbox-rs#351 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: The H2 series' and the H3C's fan 3 is labelled "Chamber Fan", Bambu calls it the exhaust fanApertaarea:ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
bug front P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
invoicerr-app/invoicerr#964 ·
I maintainer di solito rispondono entro 1 giorno