The binding-name contract
A deploy that succeeds and a form that returns 500 on every submit — a small lesson about two strings that must agree and no tool that checks.
The Nexus waitlist is one Cloudflare Pages Function and one D1 table. The function
reads env.nexus_waitlist; wrangler.toml binds the database under that name. Two
strings, one contract.
On the first deploy they disagreed. wrangler d1 create prints a config snippet with
its own idea of a binding name, I pasted it, and the deploy went through without a
word of complaint — because nothing checks that the name in the config matches the
property the code reads. Every signup returned 500 until I noticed.
The fix was a one-line rename. The lesson is the kind I keep relearning: when two things have to agree and no tool enforces it, write the contract down where the next person will trip over it. That’s now the first section of the deployment doc, in bold.