Skip to content

Buffer streamed responses before edge caching#6

Merged
gavdevs merged 1 commit intomainfrom
fix/buffer-cached-responses
Mar 13, 2026
Merged

Buffer streamed responses before edge caching#6
gavdevs merged 1 commit intomainfrom
fix/buffer-cached-responses

Conversation

@gavdevs
Copy link
Copy Markdown
Member

@gavdevs gavdevs commented Mar 13, 2026

Summary

  • Cache API silently rejects responses without Content-Length
  • TanStack Start uses defaultStreamHandler which streams HTML (chunked transfer encoding)
  • cache.put() from Use Cloudflare Cache API for actual edge caching #5 was silently failing on every request
  • Now buffers the full response body via arrayBuffer() before storing in edge cache

Context

Follow-up to #5 — edge caching still wasn't working because streamed responses can't be cached. This is why Turso reads stayed at 25M after the previous fix.

Cache API rejects responses without Content-Length. TanStack Start
streams HTML (chunked transfer), so cache.put() was silently failing.
Now reads the full response body into an ArrayBuffer first.
@gavdevs gavdevs merged commit c4f1979 into main Mar 13, 2026
1 of 2 checks passed
gavdevs added a commit that referenced this pull request Apr 5, 2026
Buffer streamed responses before edge caching
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