Description
First off — love the work on EmDash, the DX is genuinely great. This one took me a while to track down, so I'm sharing it here to save others the pain.
When using d1({ binding: 'DB', session: 'auto' }) combined with the global_fetch_strictly_public compatibility flag in wrangler.jsonc, every SSR request hangs indefinitely and eventually gets killed by the CF Worker timeout (~10s).
Environment
- EmDash:
0.15.0
@emdash-cms/cloudflare: 0.15.0
- Astro:
6.x with @astrojs/cloudflare adapter
- Deployment: Cloudflare Workers (not Pages)
wrangler.jsonc
{
"compatibility_flags": ["global_fetch_strictly_public", "nodejs_compat"],
...
}
astro.config.mjs
import { d1, r2, access, sandbox } from '@emdash-cms/cloudflare';
emdash({
database: d1({ binding: 'DB', session: 'auto' }),
// ...
})
Symptoms
- All SSR routes hang and time out (~10s)
- Static assets (served by ASSETS binding) work fine
/_emdash/* routes redirect correctly via CF Access
wrangler tail shows:
outcome: "canceled"
cpuTime: ~8ms (almost no CPU work done)
wallTime: ~10000ms
exceptions: []
logs: []
- No errors in logs whatsoever — makes it very hard to diagnose
Root cause hypothesis
session: 'auto' uses binding.withSession() under the hood, which likely makes an internal Cloudflare HTTP call to initialize the D1 Sessions API. The global_fetch_strictly_public flag blocks connections to private/internal Cloudflare addresses, causing the call to hang silently until the Worker is killed.
Workaround
Change session: 'auto' to session: 'disabled':
database: d1({ binding: 'DB', session: 'disabled' })
This immediately fixes the hang — all SSR routes respond normally.
Suggestion
It would be great if EmDash could either:
- Document the incompatibility between
session: 'auto' and global_fetch_strictly_public in the docs/README
- Add a timeout on session initialization with a clear error message instead of a silent hang
- Auto-detect the flag and fall back to
session: 'disabled' automatically
Thanks for the great project — hope this helps someone!
Description
First off — love the work on EmDash, the DX is genuinely great. This one took me a while to track down, so I'm sharing it here to save others the pain.
When using
d1({ binding: 'DB', session: 'auto' })combined with theglobal_fetch_strictly_publiccompatibility flag inwrangler.jsonc, every SSR request hangs indefinitely and eventually gets killed by the CF Worker timeout (~10s).Environment
0.15.0@emdash-cms/cloudflare:0.15.06.xwith@astrojs/cloudflareadapterwrangler.jsonc
{ "compatibility_flags": ["global_fetch_strictly_public", "nodejs_compat"], ... }astro.config.mjs
Symptoms
/_emdash/*routes redirect correctly via CF Accesswrangler tailshows:outcome: "canceled"cpuTime: ~8ms(almost no CPU work done)wallTime: ~10000msexceptions: []logs: []Root cause hypothesis
session: 'auto'usesbinding.withSession()under the hood, which likely makes an internal Cloudflare HTTP call to initialize the D1 Sessions API. Theglobal_fetch_strictly_publicflag blocks connections to private/internal Cloudflare addresses, causing the call to hang silently until the Worker is killed.Workaround
Change
session: 'auto'tosession: 'disabled':This immediately fixes the hang — all SSR routes respond normally.
Suggestion
It would be great if EmDash could either:
session: 'auto'andglobal_fetch_strictly_publicin the docs/READMEsession: 'disabled'automaticallyThanks for the great project — hope this helps someone!