Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

prerender: wait for env-runner worker readiness before crawling

Open Beginner friendly
#4,901 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@sarankumar1325 is already working on this.

Since Oct 22, 2026.

  • #4902 by @sarankumar1325 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
bun, node.js, typescript

Research direction

Start in src/prerender/prerender.ts, the startup path identified in the issue. Check how the bundled prerender worker is started and whether readiness is awaited before the first route is crawled. Confirm with the supplied slow-entry.mjs and repro.mjs scenario: the first request should wait for readiness, return HTTP 200, and startup failures should still fail the build.

Written by the indexing model from the issue text.

Description

Nitro's bundled prerenderer starts an EnvServer and immediately begins crawling without waiting for worker readiness. A cold import that takes longer than env-runner's approximately 3.1-second address wait causes the first route to fail with HTTP 503, even though the worker starts successfully shortly afterward.

Environment: macOS, Bun 1.4.3, Nitro 3.0.260903-beta, env-runner 0.2.3, TanStack Start.

In our application, requesting /docs through the generated prerender worker returned 503 worker env runner is unavailable after 3,126 ms. The worker became ready after 3,322 ms, and the same request then returned HTTP 200. This makes vite build fail with Exiting due to prerender errors.

Minimal reproduction of the worker startup race, using the env-runner version bundled with this Nitro release:

// slow-entry.mjs
await new Promise((resolve) => setTimeout(resolve, 4_000));
export default { fetch: () => new Response("ready") };
// repro.mjs
import { EnvServer } from "env-runner";

const server = await new EnvServer({
  runner: "node-worker",
  entry: new URL("./slow-entry.mjs", import.meta.url).pathname,
}).start();
try {
  console.log((await server.fetch(new Request("http://localhost/"))).status); // 503
  await server.waitForReady();
  console.log((await server.fetch(new Request("http://localhost/"))).status); // 200
} finally {
  await server.close();
}

Expected behavior: Nitro waits for the prerender worker to become ready before requesting the first route. A startup failure should still fail the build.

The prerender startup path calls .start() without awaiting .waitForReady(). Adding await prerenderer.waitForReady() after .start() fixed the failure locally. Our full build then prerendered 33 routes, and the compiled binary smoke check passed.

This is separate from the Vite SSR import wait fixed in #4295. The affected path here is the bundled prerender worker started during a production build.

Dominant language
TypeScript
Stars
11.3k
Forks
932
Avg merge
1d 14h
Merged PRs (30d)
164

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nitrojs/nitro

All issues in nitrojs/nitro

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.