billflare.

Next.js ISR on OpenNext + Workers KV: why the cache never expires and how to cap it

Meathill traces a KV storage overage on his own site to OpenNext's KV incremental cache writing keys without a TTL and keeping every deploy's build-prefixed snapshot, then shows how he rebuilt the cache lifecycle.

Products
WorkersKV
Source
Author experienceMeathill’s blog (meathill.com)
Author
Meathill (@meathill1)

Key points

  • The author found that OpenNext's KV incremental cache calls kv.put() without an expirationTtl (the source still carries a TODO about KV TTL), so a page's revalidate value does not make the KV entry expire.
  • Each opennextjs-cloudflare deploy runs populateCache, which bulk-puts every prerendered page's HTML and RSC payload under the new Build ID prefix. Old prefixes are never read again but stay stored; after dozens of deploys his namespace reached 24 GB, and the billing period showed 3.59 GB-month of storage.
  • His fix: move to a new namespace and delete the old one, wrap the cache so every put carries expirationTtl = min(7 days, max(60 s, 2 × revalidate)), and patch the bulk-put step to add expiration_ttl 604800.
  • Official KV docs (rechecked 2026-10-14): Workers Paid includes 1 GB stored, then $0.50 per GB-month; each key in a REST bulk write counts as one write; expirationTtl must be at least 60 seconds, and expired keys stop counting toward storage.

Original sources

  1. Published

    潜伏的缓存刺客:Next.js + OpenNext + Cloudflare KV 存储暴涨实录

    Open original source

    Meathill traces a KV storage overage on his own site to OpenNext's KV incremental cache writing keys without a TTL and keeping every deploy's build-prefixed snapshot, then shows how he rebuilt the cache lifecycle.

    Read originalArchived

    This archive does not contain the complete text.

    潜伏的缓存刺客:Next.js + OpenNext + Cloudflare KV 存储暴涨实录

    昨天,我发现 KV 存储又爆了……
  2. The author shares the article on 𝕏 and lists his 2026 bill surprises by month: image transformations (July), containers (August), self-inflicted prefetch traffic (September) and the KV cache (October).

    Read on 𝕏

    Meathill

    @meathill1 · Original 𝕏 post

    作为Cloudflare资深用户,我的独立开发生涯不断被账单背刺: - 七月:图片转换被坑 - 八月:容器使用被坑 - 九月:prefetch DDOS 自己 - 十月:KV 缓存爆炸 这次分享的,就是我本以为开源框架应该已经做好了,但实际上 // TODO 多年的一个缓存陷阱: https://t.co/NjRzSo510W
Author experienceWorkers +4

Cloudflare costs $5 a month, but the bill is not capped

不追高 (@Ariella1213) writes an X article explaining that Workers Paid’s $5 is a minimum, that per-product limits and budget alerts do not cap the account bill, and how denial-of-wallet requests, write amplification, delayed stops and background retries add cost.

D1

Kun Save Point (@Savepoint_kk): a D1 bug rewrote unchanged data into a $2,739.12 bill; $2,141 goodwill credit granted.

Kun Save Point (@Savepoint_kk), an indie developer who says he recently lost his job, says a bug repeatedly rewrote unchanged data while inefficient queries amplified reads, producing a $2,739.12 Cloudflare bill already paid via PayPal (D1 rows written $2,641.00, rows read $64.06, other services $34.06); he says his bills were usually under $10 a month. Cloudflare granted a $2,141 goodwill account credit under case #02391058. He asks for it to be converted into a refund to the original PayPal payment, or at least for relief on the $2,641 write charges, and later writes that the initial request was declined and has been reopened for additional review. On October 25 he adds that he missed the only alert email Cloudflare sent, whose amount was not particularly high, and received no further warning before the large card charge; on October 26 he writes that the refund request to the original payment method is still under further review. On November 10 he posts a timeline saying that after following up on November 10–11, support again stated the $2,141 could only remain as account credit and the remaining $598.12 was still undecided while the ticket was being closed. On 26 November 2026 the author posted another public thread asking what a "final decision" means. He says that in the first case an agent called a refund impossible as a "final decision," then submitted it for further review; that after several business days he was told the account credits could not be refunded while the remaining amount was still under review; and that the first case was later closed without a clear resolution of that remaining amount. He opened a second case; an agent said the remaining amount had been definitively rejected, another "final decision." After the author posted on X, a senior billing specialist (Agent D) confirmed that the previously rejected amount had actually been refunded. The author asked whether the larger $2,141 account credit could be converted into a cash refund; after being told it was under review, an agent from the first case declared another "final decision": no refund. The author asks who reviews these requests and why a supposedly final rejection was later followed by an actual refund, and says D1 on Workers Paid still lacks a configurable hard spending cap. The posts cite cases #02391058 and #02447083. There is no staff reply on that public thread.

Author experienceWorkers +3

A personal AI agent on the free tier: what runs out first

A dev.to guide by akaranjkar08 builds a Telegram agent on Workers, Durable Objects and Workers AI and works through the free quotas: at about 30 chats a day, Workers AI neurons run out first, then Durable Object row writes, then CPU time. Cost figures are the author's examples.