anomalyco/sst · error · VisibleError

Could not find config file for ${componentName} in "${path.r

Error message

Could not find config file for ${componentName} in "${path.resolve(configDir)}".
Expected one of: ${extensions.map(e => `${configName}${e}`).join(", ")}.

What it means

The framework adapter's config file (e.g. vite.config / astro.config named by `configName`) must exist in the given directory, because SST must inject `configPath: process.env.SST_WRANGLER_PATH` into it. No file matching any supported extension was found at that path.

Source

Thrown at platform/src/components/cloudflare/helpers/validation.ts:52

  componentName: string;
}): void {
  const { sitePath, configName, componentName } = input;

  const extensions = [".ts", ".js", ".mjs"];
  const configDir = sitePath;

  // Find the config file
  let configPath: string | undefined;
  for (const ext of extensions) {
    const candidate = path.join(configDir, `${configName}${ext}`);
    if (fs.existsSync(candidate)) {
      configPath = candidate;
      break;
    }
  }

  if (!configPath) {
    throw new VisibleError(
      `Could not find config file for ${componentName} in "${path.resolve(configDir)}".\nExpected one of: ${extensions.map(e => `${configName}${e}`).join(", ")}.`
    );
  }

  // Read and check for SST_WRANGLER_PATH pattern
  const content = fs.readFileSync(configPath, "utf-8");
  const hasWranglerPath = /configPath\s*[:=]\s*process\.env\.SST_WRANGLER_PATH/.test(content);

  if (!hasWranglerPath) {
    throw new VisibleError(
      [
        `Missing required configuration for ${componentName}.`,
        "",
        `The Cloudflare adapter must be configured with:`,
        `  configPath: process.env.SST_WRANGLER_PATH,`,
        "",
        `This is required for linked resources to work correctly:`,
        `https://sst.dev/docs/cloudflare/#cloudflare-vite-plugin`,

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Ensure the site directory contains the framework config file with a supported extension (e.g. vite.config.ts, vite.config.js).
  2. Fix the `path` in the SST component so it points at the app directory containing the config.
  3. Rename/move the config into the site directory using one of the expected names/extensions listed in the error.

Example fix

// before
new sst.cloudflare.Vite(ctx, "Site", { path: "." }); // repo root, no vite.config here
// after
new sst.cloudflare.Vite(ctx, "Site", { path: "packages/web" }); // contains vite.config.ts
Defensive patterns

Strategy: validation

Validate before calling

import fs from "fs"; import path from "path";
const dir = "packages/web";
const names = ["vite.config", "astro.config"].flatMap(n => [".ts", ".js", ".mjs"].map(e => n + e));
if (!names.some(f => fs.existsSync(path.join(dir, f)))) throw new Error("Framework config missing in " + dir);

Try / catch

try {
  new sst.cloudflare.Vite(app, "Site", { path: dir });
} catch (e) {
  if (String(e).includes("Could not find config file")) console.error("Check component path and config filename");
  else throw e;
}

Prevention

When it happens

Trigger: validateFrameworkConfig is called with a configDir that doesn't contain e.g. vite.config.ts/js/mjs or the framework's equivalent — wrong `path` in the SST component, config renamed, or config lives in a subdirectory.

Common situations: Component `path` pointing at repo root instead of app directory; monorepo where the app config is in packages/web; config file renamed (vite.config.mts etc. not in supported extension list); config stored outside the site dir.

Related errors


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