Skip to content

feat(cli)!: name the Vercel runtime function b4.func in every build - #717

Merged
blove merged 2 commits into
mainfrom
blove/vercel-function-name-b4
Sep 17, 2026
Merged

blove merged 2 commits into
mainfrom
blove/vercel-function-name-b4

Conversation

@blove

@blove blove commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Closes #687.

What changed

The runtime function is named b4.func in every build. It was index.func unless build.vercel.static was configured.

In the Build Output API a function named index is also served at /, where it shadows a static index.html. The conditional default fixed that only for builds that already shipped static assets, which left the hazard latent in two ways: an app that added a frontend later had to rename its function to get one, and anything assembling the published tree by hand had to know which of the two names a given config produced. The hazard belongs to the name, not to what a particular build emits, so the name is off the root always.

  • DEFAULT_VERCEL_FUNCTION_NAME is b4; STATIC_VERCEL_FUNCTION_NAME is gone, replaced by ROOT_VERCEL_FUNCTION_NAME naming the one value that is refused beside static.
  • .vercel/output/functions/b4.func/ replaces .vercel/output/functions/index.func/, and config.json routes /(.*) to /b4.
  • build.vercel.functionName: "index" beside build.vercel.static still fails the build. An explicit choice can shadow the static root just as the old default did.

Breaking

The published output path changes for every app using the vercel target. Anything reading .vercel/output/functions/index.func by path, such as a local smoke script importing the bundle, follows the new name. build.vercel.functionName: "index" restores the old layout for a build with no static assets.

No upgrade guide was added, at the repo owner's instruction. The changeset states the path change.

Tests

  • vercel-compose.test.ts: the bare default is now b4, asserted for an absent config, an empty config, and a routes-only config, so the name no longer depends on whether anything could be shadowed. The static case asserts it keeps the same default rather than switching to a second one.
  • vercel-target.test.ts: the emitted-tree, publication, out-dir and Build Output contract expectations move to b4.func and /b4. The test proving the default validator rejects a tree built for another name is rewritten around agent.func, since the old fixture used b4 precisely because it was not the default; it now also asserts the same tree validates when the right name is passed.
  • build-targets.test.ts, vercel-native-lane.test.ts and the native fixture's pinned artifact listing move to b4.func.

Docs updated where they stated the old name or the conditional rule: the b4 build reference, the configuration reference, the edge page including its local-bundle snippet, and the Vercel deployment guide including its artifact table and smoke script.

Validation

  • pnpm build
  • @b4run/cli typecheck and lint
  • node scripts/check-docs.mjs
  • node scripts/check-changesets.mjs
  • pnpm --dir apps/web seo:lastmod:check (manifest regenerated)
  • Full @b4run/cli suite: 167 files, 2011 passed, 4 skipped
  • Gated vercel-native lane not run locally; its pinned listing is updated in this PR and CI covers it.

🤖 Generated with Claude Code

@blove
blove enabled auto-merge (squash) September 17, 2026 23:05
@vercel

vercel Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
b4-run Ready Ready Preview Sep 17, 2026 11:20pm UTC

Request Review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

blove and others added 2 commits September 17, 2026 16:17
The runtime function was named index.func unless build.vercel.static was
configured. The Build Output API also serves a function named index at /,
where it shadows a static index.html, so the conditional default left the
hazard latent: an app that added a frontend later had to rename its function
to get one, and anything assembling the published tree by hand had to know
which of the two names a given config produced.

The hazard is a property of the name, not of what a particular build emits,
so the name is now off the root always. functions/b4.func/ replaces
functions/index.func/ and config.json routes to /b4.

BREAKING CHANGE: the published output path changes for every app using the
vercel target. Anything reading .vercel/output/functions/index.func by path
follows the new name; build.vercel.functionName: "index" restores the old
layout for a build with no static assets. Rejecting "index" beside static
stays, since an explicit choice can still shadow the static root.

Closes #687

Co-Authored-By: Claude Opus 5 <[email protected]>
#716 landed a paragraph telling readers to switch to b4.func when static is
configured. With the name unconditional that reads circularly against the
snippet above it, which already uses b4.func.

Co-Authored-By: Claude Opus 5 <[email protected]>
@blove
blove force-pushed the blove/vercel-function-name-b4 branch from 8b3fd03 to 08800f8 Compare September 17, 2026 23:19
@blove
blove merged commit 1456422 into main Sep 17, 2026
29 of 30 checks passed
@blove
blove deleted the blove/vercel-function-name-b4 branch September 17, 2026 23:38
blove added a commit that referenced this pull request Sep 18, 2026
…tion name (#720)

#717 renamed the runtime function to b4.func in every build but left two
statements of the old conditional rule in the published config type: the
functionName default, and build.vercel describing a bare build as emitting
functions/index.func.

Co-authored-by: Claude Opus 5 <[email protected]>
blove added a commit that referenced this pull request Sep 18, 2026
A reader who hits that build failure asks whether it is an oversight.
It is not: an explicit index shadows the static root exactly as the old
default did, so allowing it would reintroduce #687 in the configuration
where it matters most. Rationale from the #717 author.

Co-Authored-By: Claude Opus 5 <[email protected]>
blove added a commit that referenced this pull request Sep 18, 2026
#717 made the b4.func name unconditional and updated six references on
this page, but the opening line of "Compose with a frontend" still said
a bare build emits "a single function named `index`", contradicting the
same section eleven lines later. A reader following it goes looking for
functions/index.func in a bare build and does not find it.

Not a word swap: the sentence used the name to explain why a bare build
is the wrong shape for a SPA, and that reason is gone now that nothing
is served at the root. The real reason is what a bare build omits, so
the sentence now says that — one function, a catch-all, and no static
assets, second function, or routes of your own.

Verified against origin/main rather than the changeset:
DEFAULT_VERCEL_FUNCTION_NAME is "b4" and the root-shadowing guard moved
to its own ROOT_VERCEL_FUNCTION_NAME ("index"), so the neighbouring
claim that functionName: "index" plus static fails the build is still
accurate and stays.

Found by the session working on #687.

Co-authored-by: Claude Opus 5 <[email protected]>
blove added a commit that referenced this pull request Sep 18, 2026
* docs(upgrading): record the vercel function rename to b4.func

#717 moved the vercel target's published function from
functions/index.func to functions/b4.func and its route from /index to
/b4, in every build rather than only when static assets are configured.
Its changeset says so, but the Upgrading page carries entries at this
weight and had none, so the changeset was the only place a user learned
their deploy script needs updating.

The entry splits the migration, which is the part a reader gets burned
by: an app with no static assets can pin functionName: "index" and keep
the old path, but an app configuring build.vercel.static cannot, because
the build rejects that combination rather than publishing a tree whose
root is shadowed.

Gap found by the #679 session; behaviour verified against the shipped
resolver on main rather than the PR description.

Co-Authored-By: Claude Opus 5 <[email protected]>

* docs(upgrading): say why the index escape hatch is refused with static

A reader who hits that build failure asks whether it is an oversight.
It is not: an explicit index shadows the static root exactly as the old
default did, so allowing it would reintroduce #687 in the configuration
where it matters most. Rationale from the #717 author.

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 <[email protected]>

This branch was successfully deployed

1 active and 1 inactive deployments
Preview — 08800f87 Deployed Sep 17, 2026 by vercel[bot]
vercel-preview — 08800f87 Deployed Sep 17, 2026 by blove via vercel-native #2037
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.

vercel target: function named index shadows a static index.html at /

1 participant