Skip to content

test(e2e): show why the dev server crashed during startup - #4268

Draft
kdaviduik wants to merge 1 commit into
2026-04from
kd-e2e-dev-server-exit-output
Draft

kdaviduik wants to merge 1 commit into
2026-04from
kd-e2e-dev-server-exit-output

Conversation

@kdaviduik

@kdaviduik kdaviduik commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

When an E2E dev server crashes before it's ready, the fixture fails with Server undefined exited with code 1 and discards everything the CLI printed. Every startup crash looks identical, so there's no way to tell what failed.

These crashes are routine: each of the five most recent passing 2026-04 E2E runs logged between 2 and 6 of them, and one failed the merge queue run for #4233 (markets.spec.ts).

WHAT is this pull request doing?

When the dev server exits early or times out during startup, the error now includes the end of the CLI's output and names the store and project, instead of the server id (which is only assigned once the server is ready, so it was always undefined here).

Before:

Error: Server undefined exited with code 1

After (output trimmed):

Error: Dev server for hydrogenPreviewStorefront in skeleton exited with code 1 before it was ready.
Last dev server output:
  ⚠️  Future Flag Warning: Data request URL formats are changing in React Router v8.
  …
Error: ENOTEMPTY: directory not empty, rmdir '…/templates/skeleton/.react-router/types'

Only the last 4,000 characters are kept, and collection stops once the server is ready.

With this output, running three dev servers at a time in one project locally reproduced the crash in 8 of 165 starts, and all 8 were React Router type generation colliding on .react-router/types. The next PR in this stack retries those crashes.

When `shopify hydrogen dev` crashed before printing its URL, the fixture
rejected with "Server undefined exited with code 1" and dropped everything
the CLI had written. Every startup crash in CI looked identical, so there
was no way to tell what actually failed or how often each cause occurred.

The fixture now keeps the last few thousand characters of the CLI's
stdout/stderr until the server is ready, and puts them (ANSI codes
stripped) in the rejection for both early exits and startup timeouts.
Collection stops once the server is ready, so a healthy server holds no
extra memory for the rest of the run.

The label uses the store key and project directory instead of `id`, which
is only assigned after the server reports its port and so is always
undefined at this point. The project directory matters for recipes, which
all share one store.

Running three dev servers concurrently in one project locally reproduced
the CI crash in 8 of 165 starts, and this output identified all 8 as React
Router typegen races on `.react-router/types`.

Co-authored-by: AI (Pi/Claude Opus 5.5) <noreply@pi.dev>
@kdaviduik
kdaviduik added this pull request to stack #4270 October 24, 2026 03:40
@kdaviduik kdaviduik changed the title test(e2e): show why the dev server exited during startup test(e2e): show why the dev server crashed during startup Oct 24, 2026
@shopify

shopify Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Oxygen deployed a preview of your kd-e2e-dev-server-exit-output branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment October 24, 2026 3:42 AM

Learn more about Hydrogen's GitHub integration.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant