Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions workbench/nextjs-turbopack/app/api/e2e-h2-flag/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Repro-branch probe. Proves that `WORKFLOW_H2_MULTIPLEX`, set in this app's
* `vercel.json` `env` block, actually reaches the deployed function's *runtime*
* environment — which is where `@workflow/world-vercel` reads it, lazily, in
* `createEventsDispatcher()` (packages/world-vercel/src/http-client.ts).
*
* Without this probe a flag-off storm that measures no change is ambiguous
* between "multiplexing is not the cause" and "the flag never arrived".
*/
export const dynamic = 'force-dynamic';

export function GET() {
return Response.json({
WORKFLOW_H2_MULTIPLEX: process.env.WORKFLOW_H2_MULTIPLEX ?? null,
// Mirrors `h2MultiplexEnabled()` in world-vercel's http-client.
multiplexEnabled: process.env.WORKFLOW_H2_MULTIPLEX !== '0',
// 'vercel.json' if the deployment supplied it, 'instrumentation' if the
// fallback in instrumentation.ts had to.
source: process.env.WORKFLOW_H2_MULTIPLEX_SOURCE ?? null,
});
}
Comment on lines +12 to +21
16 changes: 16 additions & 0 deletions workbench/nextjs-turbopack/instrumentation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
import { registerOTel } from '@vercel/otel';

// Repro branch only. `vercel.json`'s `env` block is the documented way to give
// the deployed functions a runtime variable, but Vercel marks it deprecated, so
// this is the belt to that suspenders: if the block were ignored, a storm here
// would measure stock main and read as "multiplexing is not the cause".
// `@workflow/world-vercel` reads the variable lazily in
// `createEventsDispatcher()`, which always runs after instrumentation, so
// setting it here reaches the same code path.
// Recorded so the probe route can also tell us whether the deprecated
// `vercel.json` block still works — that decides where the real mitigation
// advice should point if #3190 turns out to own the regression.
process.env.WORKFLOW_H2_MULTIPLEX_SOURCE =
process.env.WORKFLOW_H2_MULTIPLEX === undefined
? 'instrumentation'
: 'vercel.json';
process.env.WORKFLOW_H2_MULTIPLEX ??= '0';

export function register() {
registerOTel({
serviceName: 'nextjs-turbopack',
Expand Down
3 changes: 2 additions & 1 deletion workbench/nextjs-turbopack/vercel.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"env": {
"WORKFLOW_PUBLIC_MANIFEST": "1"
"WORKFLOW_PUBLIC_MANIFEST": "1",
"WORKFLOW_H2_MULTIPLEX": "0"
},
"regions": [
"iad1",
Expand Down
Loading