Title: test: failing test for collectPrerenderPaths with getPrerenderPaths by hyfdev · Pull Request #10 · voidzero-dev/void · GitHub
Open Graph Title: test: failing test for collectPrerenderPaths with getPrerenderPaths by hyfdev · Pull Request #10 · voidzero-dev/void
X Title: test: failing test for collectPrerenderPaths with getPrerenderPaths by hyfdev · Pull Request #10 · voidzero-dev/void
Description: Bug collectPrerenderPaths() crashes when resolving dynamic pages that export getPrerenderPaths: TypeError: Cannot read properties of undefined (reading 'outsideEmitter') at Object.connect (vite/dist/node/chunks/fetchableEnvironments.js:10923) at new SSRCompatModuleRunner (fetchableEnvironments.js:10978) at ssrLoadModule (fetchableEnvironments.js:10957) at collectPrerenderPaths (deploy-BBYcX5sX.mjs:760) Root Cause collectPrerenderPaths() calls createServer({ root }) which loads the user's vite.config.ts — including @cloudflare/vite-plugin with viteEnvironment: { name: "ssr" }. This replaces the SSR environment with a FetchableDevEnvironment (CloudflareDevEnvironment). When ssrLoadModule() is then called, it creates an SSRCompatModuleRunner whose transport unconditionally accesses environment.hot.api.outsideEmitter. But FetchableDevEnvironment's hot channel has no api property (it's initialized via normalizeHotChannel({}, ...) which doesn't add api), causing the crash. Call chain ssrLoadModule() lazily creates SSRCompatModuleRunner(environment) Constructor passes environment.hot to createServerModuleRunnerTransport({ channel: environment.hot }) Transport's connect() accesses options.channel.api.outsideEmitter.on(...) — api is undefined Why api exists on RunnableDevEnvironment but not FetchableDevEnvironment RunnableDevEnvironment → createServerHotChannel() → creates api: { innerEmitter, outsideEmitter } FetchableDevEnvironment → normalizeHotChannel({}, context.hot) → no api property Why Tests Didn't Catch It The static-pages integration test only covered: Static pages (no params) — prerendered via pattern matching, no ssrLoadModule() needed Dynamic pages without getPrerenderPaths — asserted as NOT prerendered The ssrLoadModule() code path in collectPrerenderPaths() was never exercised. Reproduction This PR adds a posts/[slug] page to the static-pages playground that exports getPrerenderPaths, which triggers the crash. The test currently fails. Related Previously filed as vitejs/vite#21726 (closed) — whether this should also be addressed upstream is an open question, but regardless void should handle this case.
Open Graph Description: Bug collectPrerenderPaths() crashes when resolving dynamic pages that export getPrerenderPaths: TypeError: Cannot read properties of undefined (reading 'outsideEmitter') at Object.conne...
X Description: Bug collectPrerenderPaths() crashes when resolving dynamic pages that export getPrerenderPaths: TypeError: Cannot read properties of undefined (reading 'outsideEmitter') at Obje...
Opengraph URL: https://github.com/voidzero-dev/void/pull/10
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:5e0284e8-5dcb-6d90-d11c-2c3c68ba5ea9 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 80E2:B93E6:52978:702F4:6AFBB5F6 |
| html-safe-nonce | cb044e074763fa21fca8aa6dc0af753ca0513878aeb0f2192b27e07c222f6d3a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEUyOkI5M0U2OjUyOTc4OjcwMkY0OjZBRkJCNUY2IiwidmlzaXRvcl9pZCI6Ijc1MjM1MTg3MTE2NjU1OTczNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f3a971e40eee7549def2584b24e83f84a7a03f4330d193ad6c81856975aba415 |
| hovercard-subject-tag | pull_request:3340378211 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/voidzero-dev/void/pull/10/files |
| twitter:image | https://avatars.githubusercontent.com/u/49502170?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/49502170?s=400&v=4 |
| og:image:alt | Bug collectPrerenderPaths() crashes when resolving dynamic pages that export getPrerenderPaths: TypeError: Cannot read properties of undefined (reading 'outsideEmitter') at Object.conne... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2b2ef9c1578c18d8ed27027940544c958743213cf4461659f14d3ccdf51e162c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/voidzero-dev/void git https://github.com/voidzero-dev/void.git |
| octolytics-dimension-user_id | 149750581 |
| octolytics-dimension-user_login | voidzero-dev |
| octolytics-dimension-repository_id | 1164437080 |
| octolytics-dimension-repository_nwo | voidzero-dev/void |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1164437080 |
| octolytics-dimension-repository_network_root_nwo | voidzero-dev/void |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e4cce0e99cf61481a318ff12c2e8580153a6c7c6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width