SSR fetch ignores documented options and omits FetchError.response
维护者通常 1 天内回复
@cpojer 已经在做这个了。
开始于 2026年10月19日。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 56/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- TypeScript
- 星标
- 402
- 派生
- 32
- 平均合并
- 10 小时 51 分钟
- 30 天内合并 PR
- 100
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
voidzero-dev/void 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
voidzero-dev/void#529 ·
维护者通常 1 天内回复
-
bug
难度 1/5 1-3 小时 新手友好度 78/100
voidzero-dev/void#428 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 56/100
voidzero-dev/void#527 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 54/100
voidzero-dev/void#525 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 67/100
voidzero-dev/void#524 ·
维护者通常 1 天内回复
查看 voidzero-dev/void 的全部 Issue
相似的 Issue
-
[BUG] rag: sentence content can cross the reported sentence boundaries可能已有人在做 @LJK-ikun 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
bug needs-triage
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
README: the Resource URI Schemas example's file://documents/* pattern only matches that literal URI未关闭
难度 1/5 1 小时以内 新手友好度 88/100
platformatic/mcp#361 ·
维护者通常 1 天内回复
-
frontend
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Push: sem service worker ou sem VAPID, o interruptor de Notificações fica ligado sem avisar nada未关闭
难度 2/5 1-3 小时 新手友好度 76/100
melgarafael/DeskcommCRM#3164 ·
维护者通常 1 天内回复