Skip to content

[prebuilt-skew-protection] feat: adding user configured deployment id to build output type#14497

Merged
brookemosby merged 18 commits intomainfrom
brookemosby/flow-5149-add-user-configured-deployment-id-to-build-output-type
Jan 8, 2026
Merged

[prebuilt-skew-protection] feat: adding user configured deployment id to build output type#14497
brookemosby merged 18 commits intomainfrom
brookemosby/flow-5149-add-user-configured-deployment-id-to-build-output-type

Conversation

@brookemosby
Copy link
Copy Markdown
Contributor

@brookemosby brookemosby commented Dec 18, 2025

brookemosby/flow-5149-add-user-configured-deployment-id-to-build-output-type
Needed so we can later store on deployment document.

@brookemosby brookemosby requested a review from a team as a code owner December 18, 2025 17:33
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Dec 18, 2025

🦋 Changeset detected

Latest commit: d5439cc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@vercel/build-utils Patch
vercel Patch
@vercel/client Patch
@vercel/elysia Patch
@vercel/express Patch
@vercel/fastify Patch
@vercel/gatsby-plugin-vercel-builder Patch
@vercel/h3 Patch
@vercel/hono Patch
@vercel/nestjs Patch
@vercel/node Patch
@vercel/static-build Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 18, 2025

🧪 Test Strategy

Comparing: d63084dd5439cc (view diff)

Strategy: Code changed outside of a package - running ALL tests

⚠️ All tests will run because global code changes could impact all packages.

Affected packages - 39 (100%)
  1. @vercel-internals/get-package-json
  2. @vercel/backends
  3. @vercel/build-utils
  4. @vercel/cervel
  5. @vercel/cli-auth
  6. @vercel/client
  7. @vercel/config
  8. @vercel/detect-agent
  9. @vercel/edge
  10. @vercel/elysia
  11. @vercel/error-utils
  12. @vercel/express
  13. @vercel/fastify
  14. @vercel/firewall
  15. @vercel/frameworks
  16. @vercel/fs-detectors
  17. @vercel/functions
  18. @vercel/gatsby-plugin-vercel-builder
  19. @vercel/go
  20. @vercel/h3
  21. @vercel/hono
  22. @vercel/hydrogen
  23. @vercel/introspection
  24. @vercel/nestjs
  25. @vercel/next
  26. @vercel/node
  27. @vercel/oidc
  28. @vercel/oidc-aws-credentials-provider
  29. @vercel/python
  30. @vercel/redwood
  31. @vercel/related-projects
  32. @vercel/remix-builder
  33. @vercel/routing-utils
  34. @vercel/ruby
  35. @vercel/rust
  36. @vercel/static-build
  37. @vercel/static-config
  38. examples
  39. vercel

Results

  • Unit tests: All affected packages will run unit tests
  • E2E tests: All e2e tests will run
  • Type checks: All affected packages will run type checks

This comment is automatically generated based on the affected testing strategy

Copy link
Copy Markdown
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

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

Additional Suggestion:

The deploymentId field is defined in the BuildOutputConfig type but is never populated when constructing the config object that gets written to config.json.

View Details
📝 Patch Details
diff --git a/packages/cli/src/commands/build/index.ts b/packages/cli/src/commands/build/index.ts
index d5b28cebf..725a95cc4 100644
--- a/packages/cli/src/commands/build/index.ts
+++ b/packages/cli/src/commands/build/index.ts
@@ -974,6 +974,7 @@ async function doBuild(
     overrides.length > 0 ? Object.assign({}, ...overrides) : undefined;
 
   const framework = await getFramework(workPath, buildResults);
+  const deploymentId = getDeploymentId(buildResults.values());
 
   // Write out the final `config.json` file based on the
   // user configuration and Builder build results
@@ -985,6 +986,7 @@ async function doBuild(
     overrides: mergedOverrides,
     framework,
     crons: mergedCrons,
+    deploymentId,
   };
   await fs.writeJSON(join(outputDir, 'config.json'), config, { spaces: 2 });
 
@@ -1122,6 +1124,17 @@ function mergeWildcard(
   return wildcard;
 }
 
+function getDeploymentId(
+  buildResults: Iterable<BuildResult | BuildOutputConfig>
+): string | undefined {
+  for (const result of buildResults) {
+    if ('deploymentId' in result && result.deploymentId) {
+      return result.deploymentId;
+    }
+  }
+  return undefined;
+}
+
 /**
  * Takes the build output and writes all the flags into the `flags.json`
  * file. It'll skip flags that already exist.

Analysis

Missing deploymentId field in BuildOutputConfig

What fails: The deploymentId field is defined in the BuildOutputConfig interface but never populated in the config object written to config.json at lines 980-988 in packages/cli/src/commands/build/index.ts.

How to reproduce: A builder (e.g., Next.js) that provides a deploymentId in its build result would expect this value to appear in the final config.json. However, the field is missing from the output config object despite being defined in the interface.

// In packages/cli/src/commands/build/index.ts lines 980-988
const config: BuildOutputConfig = {
  version: 3,
  routes: mergedRoutes,
  images: mergedImages,
  wildcard: mergedWildcard,
  overrides: mergedOverrides,
  framework,
  crons: mergedCrons,
  // deploymentId is missing here
};

Result: The deploymentId field is not included in config.json even when builders provide it.

Expected: Following the pattern established for other fields like images, crons, and wildcard, the deploymentId should be extracted from the build results and included in the config object, as documented in the JSDoc comment in packages/build-utils/src/types.ts: "User-configured deployment ID for skew protection... in their next.config.js"

Fix: Added a getDeploymentId() function that extracts the deploymentId from build results (similar to existing merge functions) and assigns it to the config object before writing to config.json.

Fix on Vercel

ofhouse and others added 4 commits January 7, 2026 10:32
Disables the automatic session tracking by Sentry.
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## vercel@50.1.5

### Patch Changes

- Disable Sentry session tracking
([#14539](#14539))

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@brookemosby brookemosby merged commit 39c95ff into main Jan 8, 2026
189 checks passed
@brookemosby brookemosby deleted the brookemosby/flow-5149-add-user-configured-deployment-id-to-build-output-type branch January 8, 2026 17:55
tknickman pushed a commit that referenced this pull request Jan 12, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## vercel@50.2.0

### Minor Changes

- Add `vercel env run` command to run commands with environment
variables from the linked Vercel project without writing them to the
filesystem ([#14582](#14582))

- Merge computed rewrites/redirects to routes in Vercel config
([#14518](#14518))

### Patch Changes

- Adding in user configured deploymentId to build output type
([#14497](#14497))

- skip secondary installation for vercel.ts
([#14471](#14471))

- Updated dependencies
\[[`2eb1b7678bece13e442f8404d519bd07891eb500`](2eb1b76),
[`39c95ff6b643a63509571818e67a792df09fd71f`](39c95ff),
[`d63084dac296ccb2077ed742bc2ade0264da851d`](d63084d)]:
    -   @vercel/next@4.15.11
    -   @vercel/build-utils@13.2.5
    -   @vercel/redwood@2.4.6
    -   @vercel/rust@1.0.4
    -   @vercel/static-build@2.8.16
    -   @vercel/backends@0.0.18
    -   @vercel/elysia@0.1.16
    -   @vercel/express@0.1.23
    -   @vercel/fastify@0.1.19
    -   @vercel/go@3.3.0
    -   @vercel/h3@0.1.25
    -   @vercel/hono@0.2.19
    -   @vercel/hydrogen@1.3.3
    -   @vercel/nestjs@0.2.20
    -   @vercel/node@5.5.17
    -   @vercel/python@6.1.6
    -   @vercel/remix-builder@5.5.6
    -   @vercel/ruby@2.2.4

## @vercel/build-utils@13.2.5

### Patch Changes

- Adding in user configured deploymentId to build output type
([#14497](#14497))

- skip secondary installation for vercel.ts
([#14471](#14471))

## @vercel/client@17.2.19

### Patch Changes

- Updated dependencies
\[[`e725853a6c41bed634d1e3e2382596f17a18f342`](e725853),
[`39c95ff6b643a63509571818e67a792df09fd71f`](39c95ff),
[`d63084dac296ccb2077ed742bc2ade0264da851d`](d63084d),
[`567d2d41e685cd949274411ce0e60e61a3dc3942`](567d2d4)]:
    -   @vercel/routing-utils@5.3.2
    -   @vercel/build-utils@13.2.5

## @vercel/elysia@0.1.16

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/node@5.5.17

## @vercel/express@0.1.23

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/node@5.5.17

## @vercel/fastify@0.1.19

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/node@5.5.17

## @vercel/fs-detectors@5.7.12

### Patch Changes

- Updated dependencies
\[[`e725853a6c41bed634d1e3e2382596f17a18f342`](e725853),
[`567d2d41e685cd949274411ce0e60e61a3dc3942`](567d2d4)]:
    -   @vercel/routing-utils@5.3.2
    -   @vercel/frameworks@3.15.4

## @vercel/gatsby-plugin-vercel-builder@2.0.115

### Patch Changes

- Updated dependencies
\[[`39c95ff6b643a63509571818e67a792df09fd71f`](39c95ff),
[`d63084dac296ccb2077ed742bc2ade0264da851d`](d63084d)]:
    -   @vercel/build-utils@13.2.5

## @vercel/h3@0.1.25

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/node@5.5.17

## @vercel/hono@0.2.19

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/node@5.5.17

## @vercel/nestjs@0.2.20

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/node@5.5.17

## @vercel/next@4.15.11

### Patch Changes

- Add early validation for Next.js output directory and improve error
messages to guide users when the output directory is missing, empty, or
misconfigured. Introduces new error codes `NEXT_OUTPUT_DIR_MISSING` and
`NEXT_OUTPUT_DIR_EMPTY` with actionable guidance for common issues like
Turborepo cache misconfiguration.
([#14542](#14542))

## @vercel/node@5.5.17

### Patch Changes

- Updated dependencies
\[[`39c95ff6b643a63509571818e67a792df09fd71f`](39c95ff),
[`d63084dac296ccb2077ed742bc2ade0264da851d`](d63084d)]:
    -   @vercel/build-utils@13.2.5

## @vercel/routing-utils@5.3.2

### Patch Changes

- Add respectOriginCacheControl to rewritesSchema
([#14506](#14506))

- Add respectOriginCacheControl to routes schema
([#14565](#14565))

## @vercel/static-build@2.8.16

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/gatsby-plugin-vercel-builder@2.0.115

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

5 participants