Check getAlarm() first and keep preview off real Durable Objects
@graycoin retells the Durable Object alarm loop shared by @shmily7 and draws three habits: check getAlarm() before setAlarm(), do not bind preview environments to real Durable Objects, and reread AI-generated storage and scheduling code.
- Products
- Durable Objects
- Source
- Author experience𝕏
- Author
- @graycoin
Key points
- The author retells that an unused test project’s Durable Object alarm, written by AI, looped and made about six trillion reads and writes.
- In his account, the model scheduled another alarm inside runAlarm and reused a checkpoint close to expiry; with a 30-day TTL and a 7-day refresh window, the problem stayed hidden for about three weeks.
- He frames it as per-use serverless billing meeting self-scheduling code without a circuit breaker, and advises calling getAlarm() before setAlarm(), not binding preview environments to real Durable Objects, and rereading AI-generated storage and scheduling code.
- Cloudflare’s Alarms API documentation says each Durable Object has one alarm at a time and calling setAlarm() overwrites an existing one; it recommends checking for an existing alarm when setting one in the constructor.
Original sources
Original source · Published
Read on 𝕏🔆
@graycoin · Original 𝕏 post
Codex,以后我们小心点吧。 一位老哥 1 万刀的 Cloudflare 账单。不是被攻击,不是跑了大流量,是一个没人用的测试项目,Durable Object 的 alarm 被 AI 写成了死循环,读写了 6 万亿次。 Vibe coding 写到一半,模型顺手在 runAlarm 里又排了一次闹钟,还复用了快过期的 checkpoint。TTL 30… https://t.co/JlKn7Pytvj
More to read
A budget alert is a horn, not a brake
@GUYUE_LGY points to Cloudflare’s Budget alerts documentation: alerts send email when spend crosses a threshold but do not pause or cap usage. Before letting AI run unattended, the author checks what actually happens at the line.
hfcorriez: $100+ of AI-driven extra usage over two months, reported cancelled after emails.
@hfcorriez says AI caused over $100 of extra consumption over two months. He says that after two rounds of email explaining the situation to Cloudflare, the charges were cancelled, and posts a screenshot of two negative line items (-$31.92 and -$75.42) marked Fully Applied.
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.