anomalyco/sst · error · VisibleError

SolidStart's nitro.config.ts must be configured to use the "

Error message

SolidStart's nitro.config.ts must be configured to use the "cloudflare-module" preset. It is currently set to "${nitro.preset}".

What it means

SolidStart deploys to Cloudflare Workers through Nitro, and SST only supports the `cloudflare-module` output preset. The build's generated `.output/nitro.json` reports a different preset, so SST refuses to proceed with an incompatible bundle.

Source

Thrown at platform/src/components/cloudflare/experimental/solid-start.ts:234

    name: string,
    args: SolidStartArgs = {},
    opts: ComponentResourceOptions = {},
  ) {
    super(__pulumiType, name, args, opts);
  }

  protected buildPlan(outputPath: Output<string>): Output<Plan> {
    return outputPath.apply(async (outputPath) => {
      // Make sure aws-lambda preset is used in nitro.json
      const nitro = JSON.parse(
        await fs.readFile(
          path.join(outputPath, ".output", "nitro.json"),
          "utf-8",
        ),
      );

      if (!["cloudflare-module"].includes(nitro.preset)) {
        throw new VisibleError(
          `SolidStart's nitro.config.ts must be configured to use the "cloudflare-module" preset. It is currently set to "${nitro.preset}".`,
        );
      }

      // Make sure the server bundle is in the dist directory
      if (
        !(await existsAsync(
          path.join(outputPath, ".output", "server", "index.mjs"),
        ))
      ) {
        throw new VisibleError(
          `SSR server bundle "index.mjs" not found in the build output at:\n` +
            `  "${path.resolve(outputPath, ".output", "server")}".\n\n` +
            `If your SolidStart project is entirely pre-rendered, use the \`sst.cloudflare.StaticSite\` component instead of \`sst.cloudflare.SolidStart\`.`,
        );
      }

      // Ensure `.assetsignore` file exists and contains `server`

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Set `preset: 'cloudflare-module'` in nitro.config.ts (or the nitro section of SolidStart config) and rebuild.
  2. Remove any conflicting preset passed via CLI flags or environment variables (e.g. NITRO_PRESET).
  3. Delete stale `.output` and run a clean rebuild so nitro.json reflects the new preset.

Example fix

// before (nitro.config.ts)
export default defineNitroConfig({ preset: "cloudflare_pages" });
// after
export default defineNitroConfig({ preset: "cloudflare-module" });
Defensive patterns

Strategy: validation

Validate before calling

import { readFileSync, existsSync } from "fs";
const nitro = JSON.parse(readFileSync(".output/nitro.json", "utf-8"));
if (nitro.preset !== "cloudflare-module") throw new Error(`Set preset: 'cloudflare-module', got ${nitro.preset}`);

Type guard

const usesCloudflareModule = (nitro: { preset?: string }) => nitro.preset === "cloudflare-module";

Try / catch

try {
  new sst.cloudflare.SolidStart(app, "Site", {});
} catch (e) {
  if (String(e).includes("cloudflare-module")) console.error("Fix nitro preset and rebuild");
  else throw e;
}

Prevention

When it happens

Trigger: buildPlan reads `nitro.json` from `<outputPath>/.output/` and its `preset` field is anything other than "cloudflare-module" — e.g. `nitro.config.ts` sets `preset: 'cloudflare_pages'`, 'cloudflare', 'node-server', or the preset is left to an auto-detected default.

Common situations: Following older SolidStart/Nitro deployment docs that recommended `cloudflare_pages`; forgetting to set the preset at all; overriding preset via CLI flag (`nitro build --preset`) or environment variable; upgrading Nitro changed auto-detection.

Related errors


AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30). Data as JSON: /api/errors/f7c7403042b9fb41. Report an issue: GitHub.