fix(miniflare): Fix KV bulk/get 413 error for large namespaces#13466
fix(miniflare): Fix KV bulk/get 413 error for large namespaces#13466
Conversation
…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
🦋 Changeset detectedLatest 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 |
|
I've reviewed all the changed files thoroughly. Let me summarize my assessment: Core fix ( Tests: Good regression tests at both the unit level ( Changeset: Properly formatted Peer forwarding: The peer path still calls There are no logic bugs, security issues, backward compatibility problems, or incorrect API behavior. The change is minimal, well-targeted, and properly tested. LGTM |
|
✅ All changesets look good |
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
petebacondarwin
left a comment
There was a problem hiding this comment.
Once @emily-shen's comments are addressed, this LGTM.
emily-shen
left a comment
There was a problem hiding this comment.
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?
emily-shen
left a comment
There was a problem hiding this comment.
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.
Co-authored-by: emily-shen <69125074+emily-shen@users.noreply.github.com>
|
Codeowners approval required for this PR:
Show detailed file reviewers |
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
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.A picture of a cute animal (not mandatory, but encouraged)