Add Cloudflare Workers configuration#1
Add Cloudflare Workers configuration#1cloudflare-workers-and-pages[bot] wants to merge 2 commits into
Conversation
Reviewer's GuideConfigures the Astro project to build and deploy on Cloudflare Workers using Wrangler, adding the Cloudflare adapter, Wrangler config and scripts, and ensuring the generated worker types are included in TypeScript. Flow diagram for new Wrangler-based build and deploy scriptsflowchart TD
P[npm_run_preview] --> B1[npm_run_build]
B1 --> WD[wrangler_dev]
D[npm_run_deploy] --> B2[npm_run_build]
B2 --> WDEP[wrangler_deploy]
T[npm_run_cf-typegen] --> WT[wrangler_types]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
bmoirdevportfolio | f2f44c8 | Jun 15 2026, 01:19 AM |
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- Overriding the
previewscript to runnpm run build && wrangler devchanges its semantics from an Astro preview of the built site to a Cloudflare Worker dev server; consider keepingastro preview(or a separatepreview:cfscript) so both workflows remain available and clearly distinguished. - The
sitesetting inastro.config.mjsis still pointing at the GitHub Pages URL; if this project will now primarily be served via Cloudflare Workers, you may want to update this to the Worker’s final domain to keep canonical URLs and metadata consistent. - You’ve pinned
@astrojs/cloudflareto the bare major version "12"; if you want to pick up compatible patch/minor updates automatically, consider using a semver range like^12.0.0instead.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Overriding the `preview` script to run `npm run build && wrangler dev` changes its semantics from an Astro preview of the built site to a Cloudflare Worker dev server; consider keeping `astro preview` (or a separate `preview:cf` script) so both workflows remain available and clearly distinguished.
- The `site` setting in `astro.config.mjs` is still pointing at the GitHub Pages URL; if this project will now primarily be served via Cloudflare Workers, you may want to update this to the Worker’s final domain to keep canonical URLs and metadata consistent.
- You’ve pinned `@astrojs/cloudflare` to the bare major version "12"; if you want to pick up compatible patch/minor updates automatically, consider using a semver range like `^12.0.0` instead.
## Individual Comments
### Comment 1
<location path="astro.config.mjs" line_range="16" />
<code_context>
-});
+ },
+
+ adapter: cloudflare()
+});
\ No newline at end of file
</code_context>
<issue_to_address>
**issue (bug_risk):** Cloudflare adapter likely needs matching `output` mode configured to avoid runtime issues.
For `@astrojs/cloudflare` (v12 / Astro 5), the adapter generally expects `output: 'server'` (or `output: 'hybrid'`) in your Astro config. Please add an explicit `output` setting in this config so it matches the Cloudflare adapter’s runtime expectations.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| }); | ||
| }, | ||
|
|
||
| adapter: cloudflare() |
There was a problem hiding this comment.
issue (bug_risk): Cloudflare adapter likely needs matching output mode configured to avoid runtime issues.
For @astrojs/cloudflare (v12 / Astro 5), the adapter generally expects output: 'server' (or output: 'hybrid') in your Astro config. Please add an explicit output setting in this config so it matches the Cloudflare adapter’s runtime expectations.
8394086 to
54bf705
Compare
54bf705 to
0501172
Compare
Signed-off-by: Brian Moir <48401267+bmoir23@users.noreply.github.com>
This PR configures your project for Cloudflare Workers deployment using Wrangler autoconfig.
Merging this PR commits the configuration to your repository, enabling faster deployments and version controlled settings.
Detected settings:
astronpm run buildnpx wrangler deploynpx wrangler versions uploadNext steps after merging:
Your Worker configuration lives in
wrangler.jsonc. You can now:View build details · Join the discussion for questions or feedback