anomalyco/sst · error · VisibleError

Site directory not found at "${path.resolve(sitePath)}". Ple

Error message

Site directory not found at "${path.resolve(sitePath)}". Please check the path setting in your configuration.

What it means

SSR site components take a `path` prop pointing to the app's source directory. Before building, SST checks that this directory exists on disk; if `fs.existsSync` fails, it throws with the absolute resolved path so you can see exactly what it looked for.

Source

Thrown at platform/src/components/aws/ssr-site.ts:1209

        outputs: {
          title: devArgs.title,
          command: output(devArgs.command ?? "npm run dev"),
          autostart: output(devArgs.autostart ?? true),
          directory: output(devArgs.directory ?? sitePath),
          environment: args.environment,
          links: output(args.link || [])
            .apply(Link.build)
            .apply((links) => links.map((link) => link.name)),
        },
      };
    }

    function normalizeSitePath() {
      return output(args.path).apply((sitePath) => {
        if (!sitePath) return ".";

        if (!fs.existsSync(sitePath)) {
          throw new VisibleError(
            `Site directory not found at "${path.resolve(
              sitePath,
            )}". Please check the path setting in your configuration.`,
          );
        }
        return sitePath;
      });
    }

    function normalizeRegions() {
      return output(
        args.regions ?? [getRegionOutput(undefined, { parent: self }).region],
      ).apply((regions) => {
        if (regions.length === 0)
          throw new VisibleError(
            "No deployment regions specified. Please specify at least one region in the 'regions' property.",
          );

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Fix the `path` value in the site component args to point at the app directory containing package.json
  2. Confirm the directory exists relative to the sst.config.ts location (`ls <path>`)
  3. Check for typos and case sensitivity in the path

Example fix

// before
new sst.aws.NextjsSite("Web", { path: "apps/webs" });
// after
new sst.aws.NextjsSite("Web", { path: "apps/web" });
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync, statSync } from "fs";
const sitePath = "apps/web";
if (!existsSync(sitePath) || !statSync(sitePath).isDirectory()) {
  throw new Error(`Site path does not exist: ${sitePath}`);
}

Try / catch

try {
  new sst.aws.NextjsSite("Web", { path: sitePath });
} catch (e) {
  if (String(e).includes("Site directory not found")) console.error(`Check path: ${sitePath}`);
  throw e;
}

Prevention

When it happens

Trigger: Deploying an SSR site component whose `path` points to a nonexistent directory (typo, wrong relative path, app moved/renamed, site built from a monorepo root instead of the package dir).

Common situations: Monorepo restructures (moving apps into packages/app); running sst from a different working directory than expected; case-sensitivity mismatches on Linux CI; forgetting to rename the folder after cloning a template.

Related errors


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