{"record":{"id":"303a45be9db3a935","repo":"anomalyco/sst","slug":"react-router-assets-directory-not-found-at-a","errorCode":null,"errorMessage":"React Router assets directory not found at:\n  \"${assetsPath}\".","messagePattern":"React Router assets directory not found at:\n  \"(.+?)\"\\.","errorType":"validation","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/cloudflare/react-router.ts","lineNumber":291,"sourceCode":"\n  protected buildPlan(outputPath: Output<string>): Output<Plan> {\n    return outputPath.apply(async (outputPath) => {\n      const serverPath = path.join(outputPath, \"build\", \"server\", \"index.js\");\n      const assetsPath = path.join(outputPath, \"build\", \"client\");\n\n      if (!(await existsAsync(serverPath))) {\n        throw new VisibleError(\n          [\n            `React Router server bundle not found at:\\n  \"${serverPath}\".`,\n            \"\",\n            \"Make sure the Cloudflare Vite plugin is configured in your `vite.config.ts`.\",\n            \"If your React Router project is entirely pre-rendered, use `sst.cloudflare.StaticSite` instead.\",\n          ].join(\"\\n\"),\n        );\n      }\n\n      if (!(await existsAsync(assetsPath))) {\n        throw new VisibleError(\n          `React Router assets directory not found at:\\n  \"${assetsPath}\".`,\n        );\n      }\n\n      return {\n        server: \"./build/server/index.js\",\n        assets: \"./build/client\",\n      };\n    });\n  }\n\n  protected buildWrangler(sitePath: string) {\n    return {\n      main: path.resolve(sitePath, \"workers/app.ts\"),\n    };\n  }\n\n  /**","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/cloudflare/react-router.ts#L273-L309","documentation":"SST expects the client assets at `build/client` in the React Router output directory. When that directory is absent the Worker plan can't reference static assets, so SST throws a VisibleError. This usually means the build didn't complete as expected or the path is wrong.","triggerScenarios":"`sst deploy` on a React Router project where `build/client` does not exist: partial/failed build, custom outDir changed in vite config, or component `path` pointing at the wrong directory.","commonSituations":"Build interrupted leaving only `build/server`; moving the client outDir via Vite config without updating SST config; deploying from CI where the build step was skipped or ran in a different directory.","solutions":["Run the full project build and confirm `build/client` exists before deploying","Fix the component's `path` to the directory containing the `build/` output","Restore the default Vite outDir or configure the build so client assets land in `build/client`"],"exampleFix":"// before\nnew sst.cloudflare.ReactRouter('Site', { path: 'apps/web/dist' }); // dist has no build/client\n// after\nnew sst.cloudflare.ReactRouter('Site', { path: 'apps/web' }); // build client+server present after `vite build`","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs';\nif (!existsSync('apps/web/build/client'))\n  throw new Error('Run the full vite build first: build/client is required');\nnew sst.cloudflare.ReactRouter('Site', { path: 'apps/web' });","typeGuard":null,"tryCatchPattern":"try {\n  await deploy();\n} catch (e) {\n  if (/assets directory not found/.test(e.message)) console.error('Client build output missing; run full build');\n}","preventionTips":["Run the complete build (client + server) before deploy","Keep the default Vite outDir unless you update SST path config","Verify build/client exists in CI pipelines","Fix failed client builds instead of deploying partial output"],"tags":["react-router","cloudflare","build-output","assets"],"backgroundTag":"build-output-not-found","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}