Skip to content

fix(deploy-suite): create .next/trace before build to avoid ENOENT noise on build failure#1200

Merged
james-elicx merged 1 commit into
mainfrom
fix/deploy-script-next-trace-on-build-failure
May 14, 2026
Merged

fix(deploy-suite): create .next/trace before build to avoid ENOENT noise on build failure#1200
james-elicx merged 1 commit into
mainfrom
fix/deploy-script-next-trace-on-build-failure

Conversation

@james-elicx
Copy link
Copy Markdown
Collaborator

Summary

Removes 303 lines of Error: ENOENT: no such file or directory, lstat '/tmp/next-test-*/.next/trace' log noise per Next.js deploy-suite workflow run.

Root cause

The Next.js deploy test harness (test/lib/next-modes/base.ts) calls lstat('.next/trace') during destroy() and throws ENOENT if the file doesn't exist. vinext doesn't produce a .next/trace (it's a Next.js telemetry file), so scripts/e2e-deploy.sh creates an empty stub to satisfy that check.

The stub was being created after vinext build succeeded:

# scripts/e2e-deploy.sh, before this change
run_pnpm exec vinext build --prerender-all >> "${BUILD_LOG}" 2>&1   # line 506 — fails, set -e exits
# ...
mkdir -p ".next"            # line 520 — never reached on build failure
: > ".next/trace"

When the build (or any earlier step — pnpm install, vinext init, etc.) failed, .next/trace was never created, and the harness logged ENOENT for every failed test.

Fix

Move the stub creation to immediately after the cleanup trap is installed, before any step that can fail. The cleanup trap (cleanup_on_error) still runs on EXIT and preserves debug artifacts — this only changes when the stub file is created.

Verification

  • Walked scripts/e2e-deploy.sh end-to-end. No other path swallows the file's absence; the only producer was the post-build mkdir/touch pair.
  • cleanup_on_error() and persist_debug_artifacts() don't touch .next/trace. Belt-and-braces creation there would be redundant since the stub is now created at the very start.
  • Pre-existing bash -n syntax noise comes from a node -e JS argument and is unrelated to this change.

Note on hook bypass

VITE_GIT_HOOKS=0 was used for the commit because vp check --fix (the configured pre-commit task for * in vite.config.ts) errors out with "No files found to lint" when only a .sh file is staged. Same workaround other recent shell-only commits in scripts/e2e-deploy.sh history have hit. Filing a separate issue for the lint task's empty-input behavior is probably worthwhile.

…ise on build failure

The Next.js deploy test harness (test/lib/next-modes/base.ts) calls
lstat('.next/trace') during destroy() and throws ENOENT if the file
doesn't exist. vinext doesn't produce a .next/trace (it's a Next.js
telemetry file), so the deploy script creates an empty one as a stub.

That stub was created AFTER 'vinext build' (line ~520), so any run where
the build (or any earlier step like 'pnpm install' / 'vinext init')
failed left .next/trace missing. The test harness then logged ENOENT for
every failed test — 303 lines per deploy-suite workflow run.

Move the stub creation to immediately after the cleanup trap is
installed, before any step that can fail. The cleanup trap runs on EXIT,
so debug artifacts are still preserved; this just ensures .next/trace is
present for the test harness regardless of whether the build succeeded.

Note: VITE_GIT_HOOKS=0 used because vp check --fix errors out when no
JS/TS files are staged (only a .sh file is changed here).
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 14, 2026

Open in StackBlitz

npm i https://pkg.pr.new/vinext@1200

commit: 90025da

@github-actions
Copy link
Copy Markdown

Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original

@james-elicx james-elicx enabled auto-merge (squash) May 14, 2026 13:28
@james-elicx james-elicx merged commit 3f4e594 into main May 14, 2026
35 checks passed
@james-elicx james-elicx deleted the fix/deploy-script-next-trace-on-build-failure branch May 14, 2026 13:31
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