Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

SSR fetch ignores documented options and omits FetchError.response

Abierto
#477 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
56/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
TypeScript
Estrellas
402
Forks
32
Merge medio
12 h 28 min
PR fusionados (30 d)
77

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de voidzero-dev/void

Todos los issues de voidzero-dev/void

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.