Skip to content

cf build/deploy fails on Astro projects: Build Output Specification is never produced (1.0.0-beta.5) #18

Closed

Description

@luanxis

Summary

cf build and cf deploy cannot build or deploy any Astro project in 1.0.0-beta.5. The Astro build succeeds, and then cf fails while reading the Build Output Specification (BOS), because the Astro build never writes one:

Build Output Specification: no root config found at
/home/user/project/.cloudflare/output/v0/config.json.

cf init on an Astro project explicitly advertises cf deploy as the next step, so this blocks the documented onboarding path.

Versions

  • cf 1.0.0-beta.5 (npm i -g cf, latest published)
  • astro 7.3.5, output: "static"
  • bun 1.4.2
  • Tried also with @astrojs/cloudflare 14.3.3, and with output: "server"

Repro 1 — cf init on an existing Astro project

$ cf init .
● Setting up the existing project in /tmp/init-probe
Detected Project Settings:
 - Worker Name: website
 - Framework: Astro
 - Build Command: bunx astro build
 - Output Directory: dist
🛠️  Configuring project for Astro with "astro add cloudflare"
├ Next steps
│    cf dev     Start a local development server
│    cf deploy  Deploy to Cloudflare

$ cf deploy
├  Build
│  Delegating to bunx astro build
...
20:04:00 [build] Complete!            # <- Astro build succeeds, 4 pages
┌ Error
│ Build Output Specification: no root config found at
│ /tmp/init-probe/.cloudflare/output/v0/config.json.
└

Repro 2 — cf migrate from wrangler.jsonc (assets only, no adapter)

Existing wrangler.jsonc (static assets, no Worker script):

{
  "name": "website",
  "compatibility_date": "2026-09-27",
  "assets": { "directory": "./dist", "not_found_handling": "404-page" }
}
$ cf migrate
✔ Migration complete.   # generates cloudflare.config.ts + wrangler.config.ts

$ cf deploy --mode staging --dry-run
├  Build
│  Delegating to bunx astro build "--mode" "staging"
...
┌ Error
│ Build Output Specification: no root config found at
│ /home/user/project/.cloudflare/output/v0/config.json.
└

Repro 3 — explicit entrypoint in cloudflare.config.ts

export default defineConfig(({ mode }) => ({
  worker: {
    name: "website-staging",
    entrypoint: "./src/worker.ts",
    compatibilityDate: "2026-09-27",
    assets: { notFoundHandling: "404-page" },
  },
}));

Same error. The entrypoint is never bundled, because cf never reaches the bundler step.

What does work

A project with only an assets directory and no framework dependency works end to end:

$ cf deploy --dry-run
├  Build
│  Delegating to Wrangler
◆  Build complete
├  Deploy
│  ✨ Read 1 file from the assets directory .../.cloudflare/output/v0/workers/default/assets
◆  Dry run complete

So the Wrangler/assets code path does produce a correct BOS. The problem is that it is unreachable as soon as a supported framework is detected.

Observations

  1. The framework path is unconditional. cf build picks buildCommand from the detected framework and runs it, then requires a BOS. There is no flag, config key, or environment variable to fall back to wrangler build / the Vite plugin. For Astro this is always a dead end, because @astrojs/cloudflare is Wrangler-oriented: it writes .wrangler/deploy/config.json + dist/client/wrangler.json (a deferred-deploy config) and never writes a BOS — not in output: "static", not in output: "server".

  2. Astro is not registered as supported. In the autoconfig framework registry, Astro is { supportsCf: 0, supported: 0 }. Despite that, cf init runs the Astro autoconfig and prints cf deploy as the next step, which cannot work.

  3. cf init silently moves the assets directory. Installing @astrojs/cloudflare changes the Astro output dir from dist/ to dist/client/, which silently invalidates an existing assets.directory: "./dist".

  4. The error message is the only signal. The build succeeds, then the user gets a BOS error that doesn't mention the framework or point at a workaround.

Expected behavior

Either

  • cf build/cf deploy handles the Astro adapter's deferred deploy config (.wrangler/deploy/config.json), or
  • cf build falls back to wrangler build (the assets path) when the framework build produces no BOS, or
  • cf init refuses Astro / omits cf deploy from the next steps until it is supported, and says to keep using Wrangler.

Happy to send a PR for the fallback if that's the preferred direction.

Activity

  1. nilay1221 commented on Sep 29, 2026

    @nilay1221

    Yes, I’m also facing the same issue with a fresh Next.js project configured with OpenNext. I reproduced it with Next.js 16.3.6 and
    [email protected].

    Reproduction steps:

    • Scaffold a project:npx --yes [email protected] cf-next-opennext-repro --yes --js --no-tailwind --no-linter --app --use-npm --disable-git
    • Enter the project and install cf:cd cf-next-opennext-repro
      npm install --save-dev [email protected]
    • Run npx cf init .. This completes and installs the OpenNext adapter.
    • Run npx cf build. It runs npx next build successfully, then fails with:Build Output Specification: no root config found at
      .../.cloudflare/output/v0/config.json.
  2. added theissue type on Sep 30, 2026
  3. SIGTERM-015 commented on Sep 30, 2026

    @SIGTERM-015

    One more data point for Astro projects that use @astrojs/cloudflare with bindings, relevant once the BOS part is fixed.

    Versions: cf 1.0.0-beta.5, astro 7.3.5, @astrojs/cloudflare 14.3.3 (output: "static" with some prerender = false routes), npm.

    cf migrate --bundler vite on a wrangler.jsonc with d1_databases, send_email, vars, and assets.run_worker_first generates a correct-looking cloudflare.config.ts. After resolving the migrations_dir TODO, bindings.d1(...), bindings.sendEmail({}), bindings.text(...), bindings.secret() and assets.runWorkerFirst are all there.

    But the Astro adapter still reads bindings only from wrangler.jsonc. If wrangler.jsonc is removed after migrating, astro build (the command cf build delegates to) succeeds, but the generated dist/server/wrangler.json has no bindings at all:

    { "name": "…", "main": "entry.mjs",
      "d1_databases": [], "send_email": [], "vars": {},
      "assets": { "binding": "ASSETS", "directory": "../client" } }

    run_worker_first and not_found_handling are gone as well.

    So even with a BOS, the deployed Worker would silently lose D1, email and vars. It would also lose run_worker_first, which makes the static-asset layer serve the 404 page for on-demand routes on navigation requests. For now the only working setup is to keep wrangler.jsonc and build and deploy with Wrangler. It might be worth making cf migrate warn about this, or keep wrangler.jsonc, when @astrojs/cloudflare is detected.

  4. penalosa commented on Sep 30, 2026

    @penalosa
    Collaborator

    Astro should be fixed once this release goes out: withastro/astro#18117

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions