{"record":{"id":"117e45bf1f2e185c","repo":"anomalyco/sst","slug":"could-not-find-config-file-for-componentname-in","errorCode":null,"errorMessage":"Could not find config file for ${componentName} in \"${path.resolve(configDir)}\".\nExpected one of: ${extensions.map(e => `${configName}${e}`).join(\", \")}.","messagePattern":"Could not find config file for (.+?) in \"(.+?)\"\\.\nExpected one of: (.+?)(.+?)`\\)\\.join\\(\", \"\\)\\}\\.","errorType":"validation","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/cloudflare/helpers/validation.ts","lineNumber":52,"sourceCode":"  componentName: string;\n}): void {\n  const { sitePath, configName, componentName } = input;\n\n  const extensions = [\".ts\", \".js\", \".mjs\"];\n  const configDir = sitePath;\n\n  // Find the config file\n  let configPath: string | undefined;\n  for (const ext of extensions) {\n    const candidate = path.join(configDir, `${configName}${ext}`);\n    if (fs.existsSync(candidate)) {\n      configPath = candidate;\n      break;\n    }\n  }\n\n  if (!configPath) {\n    throw new VisibleError(\n      `Could not find config file for ${componentName} in \"${path.resolve(configDir)}\".\\nExpected one of: ${extensions.map(e => `${configName}${e}`).join(\", \")}.`\n    );\n  }\n\n  // Read and check for SST_WRANGLER_PATH pattern\n  const content = fs.readFileSync(configPath, \"utf-8\");\n  const hasWranglerPath = /configPath\\s*[:=]\\s*process\\.env\\.SST_WRANGLER_PATH/.test(content);\n\n  if (!hasWranglerPath) {\n    throw new VisibleError(\n      [\n        `Missing required configuration for ${componentName}.`,\n        \"\",\n        `The Cloudflare adapter must be configured with:`,\n        `  configPath: process.env.SST_WRANGLER_PATH,`,\n        \"\",\n        `This is required for linked resources to work correctly:`,\n        `https://sst.dev/docs/cloudflare/#cloudflare-vite-plugin`,","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/cloudflare/helpers/validation.ts#L34-L70","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the site directory contains the framework config file with a supported extension (e.g. vite.config.ts, vite.config.js).","Fix the `path` in the SST component so it points at the app directory containing the config.","Rename/move the config into the site directory using one of the expected names/extensions listed in the error."],"exampleFix":"// before\nnew sst.cloudflare.Vite(ctx, \"Site\", { path: \".\" }); // repo root, no vite.config here\n// after\nnew sst.cloudflare.Vite(ctx, \"Site\", { path: \"packages/web\" }); // contains vite.config.ts","handlingStrategy":"validation","validationCode":"import fs from \"fs\"; import path from \"path\";\nconst dir = \"packages/web\";\nconst names = [\"vite.config\", \"astro.config\"].flatMap(n => [\".ts\", \".js\", \".mjs\"].map(e => n + e));\nif (!names.some(f => fs.existsSync(path.join(dir, f)))) throw new Error(\"Framework config missing in \" + dir);","typeGuard":null,"tryCatchPattern":"try {\n  new sst.cloudflare.Vite(app, \"Site\", { path: dir });\n} catch (e) {\n  if (String(e).includes(\"Could not find config file\")) console.error(\"Check component path and config filename\");\n  else throw e;\n}","preventionTips":["Point the component `path` at the directory containing the framework config.","Use standard config filenames/extensions (vite.config.ts, etc.).","In monorepos, verify the app subdirectory, not repo root."],"tags":["cloudflare","framework-config","vite","missing-file","sst-config"],"backgroundTag":"config-file-not-found","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}