[Start]: Binary encoding issue when prerendering Server Routes.
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
- 48/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- react, typescript, vite
- Área
- backend, build-system
Línea de trabajo
Start with the linked minimal reproducer and its og-image.jpg.tsx server route; compare its development response with ./dist/client/og-image.jpg after a build. Trace how prerendering writes the route response and check whether the binary image bytes change. Done means the built image opens correctly and matches the development output, or the documentation clearly states the limitation.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Which project does this relate to?
Start
Describe the bug
When implementing Takumi with tanstack start following their guide , they use a server route to generate images on demand, however since they are og images it's not necessary to regenerate each request, even with cache control the way they set up their og-images endpoint (open search params / dynamic params) is open to cache invalidation attacks (example of attacks) unless you validate the url on the server route.
the server routes docs don't mention much about how to prerender server routes effectively, researching more i found this discussion that tells to use the prerender option with configuration for specific pages
the option to prerender api routes is available in Astro and Next.js , so i implemented it, the image show correctly in dev, but when running build command the image can no longer be opened.
researching and comparing the two files (image rendered in dev and image rendered in build) it shows the image output at build has incorrect binary format:
image header in dev (it shows):
ÿØÿà JFIF ÿÀ v° ÿÛ C
$.' ",#(7),01444'9=82<.342ÿÛ C
image header in build (it does not show):
JFIF v C
$.' ",#(7),01444'9=82<.342 C
i believe more documentation is necessary to instruct how to effectively prerender in tanstack start, especially when prerendering things like binary files (images, audio, etc.)
Complete minimal reproducer
https://github.com/JulioGrajales/tanstack-start-format-issue/
Steps to Reproduce the Bug
- download repo and install dependencies
- run dev command, visit http://localhost:3000/og-image.jpg to see the image correctly formatted
- you can check og-image[.]jpg.tsx file to see server api route
- run build command (prerender enabled), check ./dist/client/og-image.jpg file, it's corruped / incorrectly formatted
Expected behavior
Dev and build environments should produce the same files, if tanstack start is currently unable to prerender binary files in server routes it should be made clear in the documentation
Screenshots or Videos
DOWNLOAD THE GENERATED IMAGES:
images-arch.zip
Platform
-
Router / Start Version: [e.g. 1.121.0]:
"@tanstack/react-router": "^1.170.45",
"@tanstack/react-router-devtools": "^1.167.2",
"@tanstack/react-start": "^1.169.3", -
OS: [e.g. macOS, Windows, Linux]
Ubuntu WSL
C:\Users\julio>wsl --version
Versión de WSL: 2.7.13.0
Versión de kernel: 6.18.33.2-2
Versión de WSLg: 1.0.73.2
Versión de MSRDC: 1.2.7214
Versión de Direct3D: 1.611.1-81528511
Versión de DXCore: 10.0.26100.1-240331-1435.ge-release
Versión de Windows: 10.0.26200.9711 -
Browser: [e.g. Chrome, Safari, Firefox]
Google Chrome -
Browser Version: [e.g. 91.1]
Version 155.0.8059.85 (Official Build) (64-bit) -
Bundler: [e.g. vite]
Vite -
Bundler Version: [e.g. 7.0.0]
"vite": "^8.3.4"
Additional context
No response
- Lenguaje dominante
- TypeScript
- Estrellas
- 15.2k
- Forks
- 1.9k
- Merge medio
- 1 d 13 h
- PR fusionados (30 d)
- 76
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TanStack/router
-
router.startViewTransition leaves the ready/finished promises unhandled, so a skipped transition throws an unhandled AbortErrorPosiblemente ocupada @unjica la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
TanStack/router#8776 · 3 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Router devtools crash when search params contain a BigInt (JSON.stringify in history tracking)Posiblemente ocupada @A-Raphie la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
docs: `createLink` has no API reference page; 3 how-to guides link to a missing `#createlink` anchorPosiblemente ocupada @A-Raphie la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Inline scripts are duplicated after hydration when the CSP nonce is sent in a headerPosiblemente ocupada @gabriel-le la tomó hace 27 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Los mantenedores suelen responder en 1 día
-
start-plugin-core: sitemap lastmod and pages.json lastBuilt are stamped with the build's wall clock (no SOURCE_DATE_EPOCH support)Posiblemente ocupada @treadnot la tomó hace 28 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/router
Issues similares
-
type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día
-
0️⃣ phase/new
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 70/100
microsoft/playwright#43640 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100