cloudflare-pages-gotchaslisted
Install: claude install-skill jackson2w/claude-code-skills
# Cloudflare Pages + Wrangler Gotchas
Four real, non-obvious platform behaviors hit while building and deploying a
Cloudflare Pages site with Functions, KV, and R2. Each looked like a bug in
the project's own code at first; each was actually a documented (but easy to
miss) platform constraint.
## Pages Functions have NO Images binding — at all, ever
`env.IMAGES` (the on-the-fly image transform API) is unsupported on
Cloudflare Pages, full stop:
- `wrangler.toml`: an `[images]` block fails config validation on a Pages
project.
- Dashboard: Images isn't in the Pages bindings list at all (it exists for
Workers, not Pages).
This is a hard platform limit, not a config mistake to debug around.
**Solution: pre-generate the responsive/derivative images you need (WebP,
AVIF, thumbnails, etc.) at build or ingest time and serve them as plain R2
objects** — don't design around an on-the-fly resize step for Pages.
(Workers *do* support the Images binding; only Pages doesn't. `keep_vars` is
similarly Workers-only and will fail on a Pages project.)
## Empty `[env.production]` / `[env.preview]` blocks silently drop top-level bindings
In `wrangler.toml`, declaring *any* named environment block — even an empty
one — stops Wrangler from inheriting top-level `kv_namespaces` / `r2_buckets`
/ other bindings into that environment. The result: `pages deploy` (or a
branch deploy) ships with **no bindings at all**, and every Function that
touches one 500s in production while working fine lo