SSR fetch ignores documented options and omits FetchError.response
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 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
- 平均マージ
- 12時間 28分
- マージ済み PR(30日)
- 77
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
voidzero-dev/void のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
voidzero-dev/void#478 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
voidzero-dev/void#463 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
voidzero-dev/void#459 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
voidzero-dev/void#428 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
voidzero-dev/void#480 ·
メンテナーはふだん 1 日以内に返信
voidzero-dev/void の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
OpenPetsHQ/openpets#273 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
fritzprix/libr-agent#2161 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
blackboardsh/electrobun#581 ·
-
backlog-skill effort:xs frontend infra ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
LucasSantana-Dev/Lucky#2862 ·
メンテナーはふだん 1 日以内に返信