Commit eec0c0f
fix(astro): Restore Cloudflare Pages compatibility broken by cloudflare:workers env
On Cloudflare Pages (Astro v5), `cloudflare:workers` env may be
available but lack dashboard secrets (CLERK_SECRET_KEY, etc.) that are
only present in the fetch handler's env param (locals.runtime.env).
The current code short-circuits on cloudflareEnv without checking
whether the requested key actually exists, preventing the fallback
chain from ever reaching locals.runtime.env. This causes all SSR pages
to break with `[object Object]` responses.
Fix: check if the value is defined before returning from the
cloudflareEnv branch, allowing the fallback to locals.runtime.env.1 parent ad782ff commit eec0c0f
3 files changed
Lines changed: 26 additions & 1 deletion
File tree
- .changeset
- packages/astro/src/server
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
139 | 154 | | |
140 | 155 | | |
141 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
44 | 46 | | |
45 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
46 | 51 | | |
47 | 52 | | |
48 | 53 | | |
| |||
0 commit comments