Commit f8b6a09
committed
fix(docs): render raw markdown from page data, not request-time fs read
Every doc page is SSG with revalidate: 1h, so the page component re-runs on
the serverless function whenever it renders outside the prerender cache (ISR
revalidation, cold start, cache miss, RSC payload regeneration). The component
read the raw markdown via fs.readFile(page.data._file.absolutePath) for the
LLMShare copy button, but the content/docs source files are not present in the
function sandbox and the baked-in build-time path does not resolve there, so
the read threw and returned a 500.
This surfaced as intermittent 500s on freshly deployed pages: the build-time
prerendered HTML is cached at the edge (200), but the first origin hit at a
cold POP — e.g. LinkedIn's crawler scraping a new changelog URL — got the 500
error page and cached it as the link preview.
Use page.data.content (the raw markdown fumadocs bundles into the function),
matching how lib/get-llm-text.ts already sources content for the /llms.mdx
route. No filesystem access at request time, no 500.1 parent b7a46d6 commit f8b6a09
1 file changed
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
| |||
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
47 | | - | |
48 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
0 commit comments