Skip to content

fix: reconstruct build_data when missing on direct-zip deploys#8353

Open
lemusthelroy wants to merge 1 commit into
mainfrom
lemusthelroy/run-3166-cli-drops-build_data-on-direct-netlify-deploy-forcing-legacy
Open

fix: reconstruct build_data when missing on direct-zip deploys#8353
lemusthelroy wants to merge 1 commit into
mainfrom
lemusthelroy/run-3166-cli-drops-build_data-on-direct-netlify-deploy-forcing-legacy

Conversation

@lemusthelroy

@lemusthelroy lemusthelroy commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Plain netlify deploy (and netlify deploy --skip-functions-cache) has been silently sending build_data: undefined for every function in the deploy create payload. Downstream tooling relies on build_data.bootstrapVersion and build_data.runtimeAPIVersion to route function uploads correctly.

Root cause: @netlify/zip-it-and-ship-it's in-memory FunctionResult exposes bootstrapVersion and runtimeAPIVersion at the top level, but only nests them into buildData when writing the manifest cache. Without a manifest hit, func.buildData is undefined.

This patch restores the reconstruction loop originally proposed in #7099 (closed unmerged) so per-function metadata reaches the deploy record on direct-zip paths.

A companion patch in @netlify/zip-it-and-ship-it (netlify/build#7139) fixes the shape at source. This CLI change remains useful as a defense against older ZISI versions.

Test plan

  • New unit test in hash-fns.test.ts asserts fnConfig.build_data.bootstrapVersion is populated for a v2 function on the direct-zip path
  • CI

🤖 Generated with Claude Code

ZISI's in-memory FunctionResult returns bootstrapVersion at the top
level, but only nests it into buildData when writing the manifest cache.
On plain `netlify deploy` and `--skip-functions-cache`, the deploy
create payload was sending `build_data: undefined`, causing netlify-server
to store an empty bd on every function and route all function uploads
through the legacy Lambda env-var path (subject to the 4KB cap).

Reconstruct buildData from the top-level fields so bootstrap_version
lands on the deploy record correctly. Also lands a unit test asserting
build_data.bootstrapVersion is populated for v2 functions on the
direct-zip path.

RUN-3166

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lemusthelroy
lemusthelroy requested a review from a team as a code owner July 22, 2026 16:05
@netlify

netlify Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploy Preview for steady-pastelito-09e39e failed.

Name Link
🔨 Latest commit 90b5cdd
🔍 Latest deploy log https://app.netlify.com/projects/steady-pastelito-09e39e/deploys/6a60ea390cf2ff0008dc371c

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

hashFns now reconstructs missing buildData from bootstrapVersion and runtimeAPIVersion after retrieving function zips and before deriving file objects for hashing and manifest generation. A unit test covers the direct-zip path for a v2 function and verifies that the resulting configuration contains runtimeAPIVersion and a non-empty bootstrapVersion.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: eduardoboucas

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately describes the main change: reconstructing missing build_data for direct-zip deploys.
Description check ✅ Passed The description matches the changeset and explains the bug, fix, and test coverage.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lemusthelroy/run-3166-cli-drops-build_data-on-direct-netlify-deploy-forcing-legacy

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

📊 Benchmark results

Comparing with f214e69

  • Dependency count: 1,127 (no change)
  • Package size: 379 MB ⬆️ 0.00% increase vs. f214e69
  • Number of ts-expect-error directives: 358 (no change)

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
src/utils/deploy/hash-fns.ts (1)

157-158: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove comments that only describe the implementation.

These comments explain what the following code does; the fallback is self-explanatory. As per coding guidelines, **/*.{ts,tsx,js,jsx}: Never write comments on what the code does; make the code clean and self-explanatory instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/utils/deploy/hash-fns.ts` around lines 157 - 158, Remove the
implementation-detail comment above the direct-zip fallback in the hash-fns
flow, leaving the self-explanatory code unchanged.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/utils/deploy/hash-fns.ts`:
- Around line 157-158: Remove the implementation-detail comment above the
direct-zip fallback in the hash-fns flow, leaving the self-explanatory code
unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 46c337c7-3fc3-4530-8c10-a411f9d338c5

📥 Commits

Reviewing files that changed from the base of the PR and between f214e69 and 90b5cdd.

📒 Files selected for processing (2)
  • src/utils/deploy/hash-fns.ts
  • tests/unit/utils/deploy/hash-fns.test.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • netlify/blueprints (manual)

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