Repository navigation
Prerender: request timeout (10 s) and retries can't be configured in framework mode, so builds fail on loaded CI/deploy machines #15749
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Originally opened by @DavidCaabeiro in #15745.
Reproduction
Framework mode,
ssr: true, with a few paths inprerender(react-router.config.ts).Make the first prerender request take longer than 10 seconds. The simplest way is a prerendered route whose loader waits:
Run
react-router build.System Info
Used Package Manager
yarn
Expected Behavior
There's a way to give prerender requests more time, or to retry them, for builds that run on a busy machine. In our case the build runs inside an infrastructure deploy (SST / Pulumi), which bundles about 30 other functions in parallel at the same time.
Actual Behavior
The build fails:
In v8 the prerender step starts a Vite preview server and fetches each path from it. The plugin already supports
timeout(default1e4),retryCount(default0),retryDelayandmaxRedirects. In framework mode, though, the config it receives only carriesconcurrency:So 10 seconds with no retries is fixed for every framework-mode app.
The first request is the expensive one: it's the root data request (
/_.data), and it pays for the preview server loading the server build cold. We measured it, adding timing around thenodeHttpFetchcall:/_.data)react-router build)Loading the server build on its own (
import("./build/server/index.js")) takes about 6.4 s on the idle machine. Most of that is Node resolving the externalised dependencies innode_modules. So even an idle machine has little margin, and any load pushes it past 10 s. With the limit raised to 120 s in a local copy of the plugin, the same deploy build passes, and every request after the first takes milliseconds.This didn't happen on v7, where prerendering ran without a preview server.
Suggested fix
Pass the existing options through from the user config, for example:
Alternatively, raise the default timeout and retry the first request, since it includes the server's cold start. We're happy to open a pull request for the first option if that sounds right to you.
All reactions