anomalyco/sst · error

Found "basename" configured in react-router.config.ts but mi

Error message

Found "basename" configured in react-router.config.ts but missing "base" in vite.config.ts. Both configurations are required.

What it means

The inverse pairing check: a basename in react-router.config.ts without a corresponding base in vite.config.ts throws this Error, since the component requires both configurations to be set together.

Source

Thrown at platform/src/components/aws/react.ts:449

      })();

      if (viteBase) {
        if (!viteBase.endsWith("/"))
          throw new Error(
            `The "base" value in vite.config.ts must end with a trailing slash ("/"). This is required for correct asset path construction.`,
          );
        if (!reactRouterBase)
          throw new Error(
            `Found "base" configured in vite.config.ts but missing "basename" in react-router.config.ts. Both configurations are required.`,
          );
      }
      if (reactRouterBase) {
        if (reactRouterBase.endsWith("/"))
          throw new Error(
            `The "basename" value in react-router.config.ts must not end with a trailing slash ("/"). This ensures the root URL is accessible without a trailing slash.`,
          );
        if (!viteBase)
          throw new Error(
            `Found "basename" configured in react-router.config.ts but missing "base" in vite.config.ts. Both configurations are required.`,
          );
      }

      return {
        base: reactRouterBase,
        server: serverPath
          ? (() => {
            // React does perform their own internal ESBuild process, but it doesn't bundle
            // 3rd party dependencies by default. In the interest of keeping deployments
            // seamless for users we will create a server bundle with all dependencies included.

            fs.copyFileSync(
              path.join(
                $cli.paths.platform,
                "functions",
                "react-server",
                "server.mjs",

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Add a matching base: "/app/" (with trailing slash) to vite.config.ts
  2. Ensure the two values correspond (basename "/app" ↔ base "/app/")
  3. Or remove basename if no custom base path is needed

Example fix

// vite.config.ts before
export default {};
// after
export default { base: "/app/" };
Defensive patterns

Strategy: validation

Validate before calling

if (basename && !viteBase) throw new Error("base required in vite.config.ts when react-router basename is set");

Try / catch

try {
  new sst.aws.React("Web", args);
} catch (e) {
  if (String(e).includes("missing \"base\"")) console.error("Add matching base to vite.config.ts");
  throw e;
}

Prevention

When it happens

Trigger: reactRouterBase is truthy in react-router.config.ts while viteBase is falsy in vite.config.ts during buildPlan.

Common situations: Upgrading a React Router framework app that sets basename but whose vite.config.ts lacks base; partially applying a config change across the two files.

Understand the failure class

Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.

Related errors


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