{"record":{"id":"61ca9e13ba8246ac","repo":"anomalyco/sst","slug":"the-basename-value-in-react-router-config-ts-mus","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/react.ts","lineNumber":445,"sourceCode":"          const content = fs.readFileSync(rrConfig, \"utf-8\");\n          const match = content.match(/[\"']?basename[\"']?:\\s*[\"']([^\"]+)[\"']/);\n          return match ? match[1] : undefined;\n        } catch (e) { }\n      })();\n\n      if (viteBase) {\n        if (!viteBase.endsWith(\"/\"))\n          throw new Error(\n            `The \"base\" value in vite.config.ts must end with a trailing slash (\"/\"). This is required for correct asset path construction.`,\n          );\n        if (!reactRouterBase)\n          throw new Error(\n            `Found \"base\" configured in vite.config.ts but missing \"basename\" in react-router.config.ts. Both configurations are required.`,\n          );\n      }\n      if (reactRouterBase) {\n        if (reactRouterBase.endsWith(\"/\"))\n          throw new Error(\n            `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.`,\n          );\n        if (!viteBase)\n          throw new Error(\n            `Found \"basename\" configured in react-router.config.ts but missing \"base\" in vite.config.ts. Both configurations are required.`,\n          );\n      }\n\n      return {\n        base: reactRouterBase,\n        server: serverPath\n          ? (() => {\n            // React does perform their own internal ESBuild process, but it doesn't bundle\n            // 3rd party dependencies by default. In the interest of keeping deployments\n            // seamless for users we will create a server bundle with all dependencies included.\n\n            fs.copyFileSync(\n              path.join(","sourceCodeStart":427,"sourceCodeEnd":463,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/react.ts#L427-L463","documentation":"Conversely to the vite base, the basename in react-router.config.ts must NOT end with a trailing slash, so the root URL works without a trailing slash. buildPlan throws this Error when reactRouterBase ends with \"/\".","triggerScenarios":"Setting basename: \"/app/\" in react-router.config.ts (mirroring vite's base with slash) during buildPlan.","commonSituations":"Copy-pasting the trailing-slash convention from vite base into basename; assuming both files use the same format.","solutions":["Remove the trailing slash from basename in react-router.config.ts (\"/app/\" → \"/app\")","Keep vite base with the slash and basename without it","Re-run sst deploy"],"exampleFix":"// react-router.config.ts before\nexport default { basename: \"/app/\" };\n// after\nexport default { basename: \"/app\" };","handlingStrategy":"validation","validationCode":"if (basename && basename.endsWith(\"/\")) throw new Error(`react-router basename must not end with '/': ${basename}`);","typeGuard":null,"tryCatchPattern":"try {\n  new sst.aws.React(\"Web\", args);\n} catch (e) {\n  if (String(e).includes(\"basename\\\" value in react-router\")) console.error(\"Remove the trailing slash from basename\");\n  throw e;\n}","preventionTips":["Never copy the vite base trailing-slash convention into basename","Keep basename slash-free (\"/app\") while base keeps its slash","Lint both config files for slash consistency"],"tags":["react-router","routing","configuration"],"backgroundTag":"config-validation-failed","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}