SSR fetch ignores documented options and omits FetchError.response
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 56/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- backend-api-design
Rechercherichtung
Start with the generated server client in packages/void/src/router/compile.ts (the issue links the relevant section) and compare its behavior with the documented options in docs/guide/typed-fetch.md and docs/reference/api/client.md. Reproduce the listed calls for both Cloudflare Workers and Node targets. Done means server-side calls honor the documented options and retries, and FetchError.response contains the HTTP response.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
fetch() from void/client accepts documented options that are silently ignored during SSR and in server-side route handlers. HTTP errors also lack the documented FetchError.response property.
This affects the generated server clients for both Cloudflare Workers and Node targets. Verified against current main at 3d7cea3, where the void package version is 1.1.11.
Reproduction
Add a delayed endpoint:
// routes/api/slow.ts
import { defineHandler } from 'void';
export const GET = defineHandler(async () => {
await new Promise((resolve) => setTimeout(resolve, 100));
return { ok: true };
});
Add an endpoint that always returns 503 and counts attempts:
// routes/api/unavailable.ts
import { defineHandler } from 'void';
let attempts = 0;
export const GET = defineHandler((c) =>
c.json({ attempts: ++attempts }, 503),
);
Run these calls independently from SSR code or a server-side route handler:
import { fetch, FetchError } from 'void/client';
await fetch('/api/slow', { baseURL: '/prefix' });
await fetch('/api/slow', { signal: AbortSignal.abort() });
await fetch('/api/slow', { timeout: 10, retry: 0 });
// Restart the app before this call to reset the attempt counter.
try {
await fetch('/api/unavailable', { retry: 2 });
} catch (error) {
if (error instanceof FetchError) {
console.log(error.status);
console.log(error.data);
console.log(error.response);
}
}
Actual and expected behavior
| Case | Actual server-side behavior | Expected behavior |
|---|---|---|
baseURL: '/prefix' |
Calls /api/slow and returns { ok: true }. |
Uses /prefix/api/slow as the request path. |
Already-aborted signal |
The handler still runs and returns { ok: true }. |
Rejects the request without running the handler. |
timeout: 10 |
Returns the delayed response despite the deadline. | Rejects when the timeout expires. |
retry: 2 |
Calls the 503 endpoint once; error.data is { attempts: 1 }. |
Makes the initial attempt plus two retries before rejecting. |
FetchError.response |
undefined, even though error.status is 503 and error.data contains the response body. |
Contains the HTTP Response, including status 503 and its headers. |
The documented default GET retry is also absent on the server. Code using the same typed client therefore behaves differently between browser execution and SSR.
References
- Vorherrschende Sprache
- TypeScript
- Sterne
- 402
- Forks
- 32
- Ø Merge
- 12 Std. 28 Min.
- Gemergte PRs (30 T.)
- 77
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus voidzero-dev/void
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
voidzero-dev/void#478 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
voidzero-dev/void#463 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
voidzero-dev/void#459 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 78/100
voidzero-dev/void#428 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
voidzero-dev/void#480 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in voidzero-dev/void
Ähnliche Issues
-
check:passed streams:add
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
iptv-org/iptv#55821 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
vercel-labs/wterm#246 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug ready-for-agent
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
nearform/lastlight#452 · 1 Kommentar · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
fix(console): include PARTITIONED BY in generated table DDLEvtl. vergeben @aubdiy hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
apache/polaris-tools#291 ·
Maintainer antworten meist innerhalb von 6 Tagen