billflare.

Three billing traps an AI left in an e-commerce backend, and a worst-case bill audit prompt

Frank Zeng (@frankzeng2020) says his AI-built e-commerce backend ran a month at $0, but a Claude audit of its Cloudflare billing found three amplification paths; he fixed them in half a day and shares a read-only audit prompt that ranks worst-case costs.

Products
WorkersD1Queues
Source
Author experience𝕏 post
Author
Frank Zeng (@frankzeng2020)

Key points

  • Cart logic: any request without a cookie created a new cart and wrote 6 database rows, with no rate limiting; he estimates that 100 million crawler hits would cost over $500 a month. This is his estimate, not an actual charge.
  • Cron full-table scan: a job scanned every minute a table that is only appended to and never cleaned; he estimates about $400 a month once it reaches tens of millions of rows (estimate).
  • Queue loop: on failure the consumer put the message back on its own queue and reset the retry count, so whether it looped forever was down to luck.
  • His prompt, translated: review every place in this project that touches Cloudflare billing, focusing on whether anonymous requests, crawlers or infinite loops could amplify reads, writes and calls without bound; rank by the worst possible cost; analyze only, do not change code.

Original sources

  1. Published

    Original post

    Read on 𝕏

    Frank Zeng (@frankzeng2020) says his AI-built e-commerce backend ran a month at $0, but a Claude audit of its Cloudflare billing found three amplification paths; he fixed them in half a day and shares a read-only audit prompt that ranks worst-case costs.

    Frank Zeng🇨🇳🇨🇦

    @frankzeng2020 · Original 𝕏 post

    前阵子用 AI 撸了个电商后台,测完觉得挺稳,跑了一个月账单也是 0。结果突发奇想让 Claude 帮我扫了一圈 Cloudflare 的计费漏洞,当场吓出一身冷汗。 总结下来 AI 给我留了三个天坑: 购物车逻辑:只要请求不带 cookie,后端二话不说直接新建购物车,哐哐写 6 行数据库,而且完全没做限流。真要被爬虫盯上刷个一亿次,一个月五百多刀就没了。 定时任务全表扫描:每分钟扫一张只往里加、从不清理的表。现在数据少没感觉,等攒到上千万行,每个月又得白掏四百刀。 队列死循环:消费者处理失败把消息又扔回自己的队列,结果重试计数还顺手给清零了,纯看运气会不会死循环。 改起来倒挺快,半天就填平了。 真的,AI 写的代码只要能跑就完事,根本不管云厂商怎么按量计费。以后新项目上线前,建议让它专门审计一下最坏情况下的账单: “审查一下这个项目涉及 Cloudflare 计费的所有地方。重点排查匿名请求、爬虫或者死循环会不会导致读写调用被无限放大,按可能产生的最坏费用排个序。只分析,别改代码。” 你们被云账单坑过没?
  2. Author reply in the thread: the worst part is that normally nothing happens and the bill is $0, so you never think to check; by the time crawlers find it and you see the bill, it is too late.

    Read on 𝕏

    Frank Zeng🇨🇳🇨🇦

    @frankzeng2020 · Original 𝕏 post

    @An_yhl 对,最坑的就是平时一点动静没有,账单也是 0,根本想不到去查。等哪天被爬虫盯上,看到账单就晚了😂
Author experienceWorkers +5

Six free allowances and four kinds of cost: estimating a Cloudflare bill line by line

Su (@Sukiea1008) lists six common Cloudflare free allowances and four kinds of cost — separately bought items, hard stops at free limits, metered usage on enabled services, and other services such as models and email — and walks through a PDF summariser to show why each line must be estimated in its own unit.

Durable Objects

igorrizzom: a forgotten Durable Object alarm billed US$ 2,038; Support refunded US$ 1,533.29, leaving US$ 505.

X user @igorrizzom (Igor Rizzo), who also posted on Cloudflare Community as igorarm (urnaaovivo.com), says a personal, non-commercial prototype that collected public election data in Brazil was left running after the October 25 runoff. A Durable Object kept rescheduling itself via alarm every ~5 seconds and writing to SQLite, and the invoice reached US$ 2,038, almost all from DO rows written, with about 10k pageviews. The author says budget alerts were set up but went to an old inbox that was never checked, and that alerts do not stop usage. Spend limits for Workers and Durable Objects were only announced on November 13, after almost all of the usage; the author then set a US$ 1 spend limit, turned the collector off, and removed Cron Triggers. The author says Support refunded US$ 1,533.29 as a one-time courtesy. The remaining US$ 505, which the author later described as US$ 500 of usage plus the US$ 5 Workers Paid fee, was closed as final; the author asked for a supervisor review in case #02442826 (follow-up to #02435308) and also asked @SidChatterjee whether any goodwill path remained for pre-launch cases. There is no Cloudflare staff reply on the public X thread or the Community thread. Public Support actions are reported by the author.

Official docsWorkers Logs +3

Observability pricing (from December 1, 2026)

Cloudflare’s unified pricing for logs and traces: Workers Logs, Workers Traces, Containers logs, R2 data access logs and AI Gateway logs move to per-GB ingestion and GB-month storage on December 1, 2026.