← ClaudeAtlas

cloudflare-pages-gotchaslisted

This skill should be used when working on a Cloudflare Pages project with Pages Functions — debugging on-the-fly image resizing that won't work, a wrangler.toml with named [env.*] blocks where bindings mysteriously go missing in one environment, a crypto.subtle PBKDF2 call that throws in production but works locally, or a _redirects rule that silently never fires on a path a Function also handles. Trigger phrases include "pages images binding", "env.IMAGES", "wrangler.toml env production", "bindings missing in production", "PBKDF2 iterations error", "NotSupportedError iteration counts", "_redirects not working", "redirect skipped by functions", "pages function precedence".
jackson2w/claude-code-skills · ★ 1 · DevOps & Infrastructure · score 67
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