[Start]: Binary encoding issue when prerendering Server Routes.
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- react, typescript, vite
- 领域
- backend, build-system
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- TypeScript
- 星标
- 15.2k
- 派生
- 1.9k
- 平均合并
- 1 天 4 小时
- 30 天内合并 PR
- 63
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TanStack/router 的其他 Issue
-
router.startViewTransition leaves the ready/finished promises unhandled, so a skipped transition throws an unhandled AbortError可能已有人在做 @unjica 于 5 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
TanStack/router#8776 · 3 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
Router devtools crash when search params contain a BigInt (JSON.stringify in history tracking)可能已有人在做 @A-Raphie 于 9 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
docs: `createLink` has no API reference page; 3 how-to guides link to a missing `#createlink` anchor可能已有人在做 @A-Raphie 于 9 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
Inline scripts are duplicated after hydration when the CSP nonce is sent in a header可能已有人在做 @gabriel-le 于 30 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
start-plugin-core: sitemap lastmod and pages.json lastBuilt are stamped with the build's wall clock (no SOURCE_DATE_EPOCH support)可能已有人在做 @treadnot 于 31 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
相似的 Issue
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 1/5 1 小时以内 新手友好度 82/100
lingdojo/kana-dojo#33286 · 1 条评论 · 5 个 reaction ·
维护者通常 1 天内回复
-
friction
难度 1/5 1 小时以内 新手友好度 77/100
kentcdodds/kody#4499 ·
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
hemilabs/ui-monorepo#2605 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 6 天内回复
-
build.yml: macOS arm64 DMG fails, cargo missing on the macos-26 runner image可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
getopenscreen/openscreen#1423 ·
维护者通常 1 天内回复