Skip to content

fix(dev): initialize App instrumentation in the RSC runner - #3363

Open
lyzno1 wants to merge 4 commits into
cloudflare:mainfrom
lyzno1:codex/fix-instrumentation-rsc-runtime
Open

lyzno1 wants to merge 4 commits into
cloudflare:mainfrom
lyzno1:codex/fix-instrumentation-rsc-runtime

Conversation

@lyzno1

@lyzno1 lyzno1 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Fixes #3361.

Node App Router dev loads instrumentation through the Pages SSR runner, rejecting dynamic server-only imports and initializing different module instances from App requests. Reuse the existing RSC runner so registration uses React server conditions and shares initialized module state with request handling. Pages-only startup keeps its direct runner; external runtimes initialize through their own entries.

Alternative to #3362 for the Node dev regression, without widening the server-only allowlist. Matches Next.js's server-layer instrumentation test and initialization ordering.

Regression tests cover static/dynamic imports, React conditions, module state, async ordering, concurrent registration, Pages-first hybrid requests, failed registration, and rejection of a Client Component importing the same server-only dependency. A Playwright E2E in the existing non-Cloudflare app-with-src fixture opens the affected page and verifies that instrumentation initialized the same server-only module instance used by the App request.

Validation:

  • Controlled E2E red/green: main fails with the reported 'server-only' cannot be imported in client build ('ssr' environment) chain and the PR head passes.
  • PLAYWRIGHT_PROJECT=app-with-src vp exec playwright test --project=app-with-src (4 passed)
  • vp test run tests/instrumentation-dev.test.ts tests/instrumentation.test.ts (50 passed)
  • Focused App production module-identity test (1 passed)
  • vp check
  • vp run vinext#build
  • node scripts/ci-integration-shard.mjs --check --shard-total=10

@pkg-pr-new

pkg-pr-new Bot commented Sep 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vinext/cloudflare

npm i https://pkg.pr.new/@vinext/cloudflare@3363

create-vinext-app

npm i https://pkg.pr.new/create-vinext-app@3363

@vinext/types

npm i https://pkg.pr.new/@vinext/types@3363

vinext

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

@cloudflare/workers-response-store

npm i https://pkg.pr.new/@cloudflare/workers-response-store@3363

commit: 41f9bd8

@lyzno1 lyzno1 closed this Sep 22, 2026
@lyzno1 lyzno1 reopened this Sep 22, 2026
@github-actions

github-actions Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared 41f9bd8 against base 3898ef2 using alternating same-runner rounds. Next.js was unchanged and skipped.

0 improved · 0 regressed · 6 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 142.3 KB 142.3 KB ⚫ +0.0%
Client entry size (gzip) vinext 129.7 KB 129.7 KB ⚫ +0.0%
Dev server cold start vinext 3.51 s 3.48 s ⚫ -0.8%
Production build time vinext 3.96 s 4.00 s ⚫ +1.0%
RSC entry closure size (gzip) vinext 127.5 KB 127.6 KB ⚫ +0.0%
Server bundle size (gzip) vinext 225.6 KB 225.7 KB ⚫ +0.0%

View detailed results and traces

🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head

@james-elicx

Copy link
Copy Markdown
Member

/bigbonk review for issues

Time limit: 8 minutes. Complete the review and post all findings within that limit.

@ask-bonk

ask-bonk Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

@james-elicx Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.

@james-elicx

Copy link
Copy Markdown
Member

/bigbonk review for issues

Time limit: 8 minutes. Complete the review and post all findings within that limit.

Comment thread packages/vinext/src/index.ts
@ask-bonk

ask-bonk Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Posted 1 actionable inline finding. Targeted instrumentation tests pass.

github run

@james-elicx

Copy link
Copy Markdown
Member

/bigbonk review for issues

Time limit: 8 minutes. Complete the review and post all findings within that limit.

@ask-bonk

ask-bonk Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

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.

App Router: server-only import from instrumentation.ts rejected in SSR after upgrading to beta.11

2 participants