Skip to content

fix(miniflare): Fix KV bulk/get 413 error for large namespaces#13466

Merged
NuroDev merged 23 commits intomainfrom
NuroDev/local-explorer-kv-413
Apr 20, 2026
Merged

fix(miniflare): Fix KV bulk/get 413 error for large namespaces#13466
NuroDev merged 23 commits intomainfrom
NuroDev/local-explorer-kv-413

Conversation

@NuroDev
Copy link
Copy Markdown
Member

@NuroDev NuroDev commented Apr 14, 2026

Fixes #13459.

Summary

The Local Explorer's KV bulk/get endpoint was using kv.get(keys) which delegates to the KV bulk-get API. This API enforces a 25 MB aggregate size limit, causing a 413 error when browsing namespaces with large values.

Replace the single bulk-get call with individual per-key fetches via Promise.all. The number of concurrent fetches is bounded by the UI page size (50 keys), so this is safe and avoids the aggregate limit entirely.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: Bug fix

A picture of a cute animal (not mandatory, but encouraged)

NuroDev added 2 commits April 13, 2026 20:57
…aces

The Local Explorer's KV bulk/get endpoint was using kv.get(keys) which
delegates to the KV bulk-get API. This API enforces a 25 MB aggregate
size limit, causing a 413 error when browsing namespaces with large
values.

Replace the single bulk-get call with individual per-key fetches via
Promise.all. The number of concurrent fetches is bounded by the UI page
size (50 keys), so this is safe and avoids the aggregate limit entirely.

Fixes #13459
@NuroDev NuroDev self-assigned this Apr 14, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 14, 2026

🦋 Changeset detected

Latest commit: ac19731

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

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

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Apr 14, 2026

I've reviewed all the changed files thoroughly. Let me summarize my assessment:

Core fix (kv.ts:414-419): Replaces kv.get(keys) (bulk-get API) with Promise.all of individual kv.get(key) calls. This is a clean, correct fix for the 413 error. The concurrency is bounded by page size (50 keys), so it's safe.

Tests: Good regression tests at both the unit level (kv.spec.ts) and fixture level (index.test.ts). The unit test leverages the lower test-mode bulk limit (1 KiB) to avoid needing huge payloads.

Changeset: Properly formatted patch bump for miniflare.

Peer forwarding: The peer path still calls /bulk/get on the remote, but that's correct since the remote instance will also run the fixed handler.

There are no logic bugs, security issues, backward compatibility problems, or incorrect API behavior. The change is minimal, well-targeted, and properly tested.

LGTM

github run

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

✅ All changesets look good

@NuroDev NuroDev marked this pull request as ready for review April 14, 2026 09:45
@workers-devprod workers-devprod requested review from a team and petebacondarwin and removed request for a team April 14, 2026 09:46
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Apr 14, 2026

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • packages/local-explorer-ui/src/e2e/kv/kv-namespace.spec.ts: [@cloudflare/wrangler]
  • packages/local-explorer-ui/src/e2e/utils.ts: [@cloudflare/wrangler]
  • packages/local-explorer-ui/src/routes/kv/$namespaceId.tsx: [@cloudflare/wrangler]

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 14, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@13466

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@13466

miniflare

npm i https://pkg.pr.new/miniflare@13466

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@13466

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@13466

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@13466

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@13466

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@13466

wrangler

npm i https://pkg.pr.new/wrangler@13466

commit: ac19731

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

Comment thread packages/miniflare/test/plugins/local-explorer/kv.spec.ts Outdated
Comment thread fixtures/worker-with-resources/tests/index.test.ts
Comment thread packages/miniflare/src/workers/local-explorer/resources/kv.ts Outdated
Copy link
Copy Markdown
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

Once @emily-shen's comments are addressed, this LGTM.

Copy link
Copy Markdown
Contributor

@emily-shen emily-shen left a comment

Choose a reason for hiding this comment

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

Argh the HTTP API also enforces a 25MB limit - if we wanted to accurately simulate the API, the old behaviour is technically correct. What if the UI made the individual get requests instead?

Comment thread .changeset/fix-explorer-kv-bulk-get-413.md Outdated
Comment thread fixtures/worker-with-resources/src/index.ts Outdated
Copy link
Copy Markdown
Contributor

@emily-shen emily-shen left a comment

Choose a reason for hiding this comment

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

Have thought about it and i think we should accurately reflect the real API, which enforces the 25MB limit too, and i think we should make the UI do the promise.all() get each key bit.

@github-project-automation github-project-automation bot moved this from Untriaged to In Review in workers-sdk Apr 15, 2026
Comment thread packages/local-explorer-ui/src/routes/kv/$namespaceId.tsx
@NuroDev NuroDev requested a review from emily-shen April 16, 2026 10:42
devin-ai-integration[bot]

This comment was marked as resolved.

Comment thread .changeset/fix-explorer-kv-bulk-get-413.md Outdated
NuroDev and others added 2 commits April 16, 2026 15:27
Co-authored-by: emily-shen <69125074+emily-shen@users.noreply.github.com>
@NuroDev NuroDev requested a review from emily-shen April 16, 2026 15:17
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Apr 20, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

Copy link
Copy Markdown
Contributor

@workers-devprod workers-devprod left a comment

Choose a reason for hiding this comment

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

Codeowners reviews satisfied

@github-project-automation github-project-automation bot moved this from In Review to Approved in workers-sdk Apr 20, 2026
@NuroDev NuroDev merged commit c4461ff into main Apr 20, 2026
51 of 53 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Apr 20, 2026
@NuroDev NuroDev deleted the NuroDev/local-explorer-kv-413 branch April 20, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Local Explorer: KV bulk/get fails with 413 when namespace contains large values

4 participants