{"record":{"id":"c8c137d35f4d84d9","repo":"anomalyco/sst","slug":"you-must-provide-the-password-to-connect-to-your-l-c8c137","errorCode":null,"errorMessage":"You must provide the password to connect to your locally running OpenSearch domain either by setting the \"dev.password\" or by setting the top-level \"password\" property.","messagePattern":"You must provide the password to connect to your locally running OpenSearch domain either by setting the \"dev\\.password\" or by setting the top-level \"password\" property\\.","errorType":"exception","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/open-search.ts","lineNumber":367,"sourceCode":"        const size = toGBs(v);\n        if (size < 10) {\n          throw new VisibleError(\n            `Storage must be at least 10 GB for the ${name} OpenSearch domain.`,\n          );\n        }\n        return size;\n      });\n    }\n\n    function registerDev() {\n      if (!args.dev) return undefined;\n\n      if (\n        $dev &&\n        args.dev.password === undefined &&\n        args.password === undefined\n      ) {\n        throw new VisibleError(\n          `You must provide the password to connect to your locally running OpenSearch domain either by setting the \"dev.password\" or by setting the top-level \"password\" property.`,\n        );\n      }\n\n      const dev = {\n        enabled: $dev,\n        url: output(args.dev.url ?? \"http://localhost:9200\"),\n        username: args.dev.username ? output(args.dev.username) : username,\n        password: output(args.dev.password ?? args.password ?? \"\"),\n      };\n\n      new DevCommand(`${name}Dev`, {\n        dev: {\n          title: name,\n          autostart: true,\n          command: `sst print-and-not-quit`,\n        },\n        environment: {","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/open-search.ts#L349-L385","documentation":"In `$dev` mode SST runs OpenSearch locally and the local instance requires a password. When neither `dev.password` nor the top-level `password` is provided, SST cannot configure the local connection and throws this VisibleError at component registration time.","triggerScenarios":"Declaring an sst.aws.OpenSearch component inside `if ($dev)` (or with dev enabled) while passing neither args.dev.password nor args.password during `sst dev`.","commonSituations":"Running `sst dev` for the first time after copying a production config that omits dev settings; team members lacking a local .env with the dev password.","solutions":["Add `dev: { password: \"password\" }` to the OpenSearch args","Or set the top-level `password` property, which is used for both dev and production","Or load it from config/env so it isn't hardcoded"],"exampleFix":"// before\nnew sst.aws.OpenSearch(\"MySearch\", {});\n// after\nnew sst.aws.OpenSearch(\"MySearch\", {\n  dev: { password: \"password\" }\n});","handlingStrategy":"validation","validationCode":"if ($dev && args.dev?.password === undefined && args.password === undefined) {\n  throw new Error(\"Provide dev.password or password for local OpenSearch\");\n}","typeGuard":"function hasDevPassword(args: { dev?: { password?: string }, password?: string }): boolean {\n  return args.dev?.password !== undefined || args.password !== undefined;\n}","tryCatchPattern":"try {\n  new sst.aws.OpenSearch(\"MySearch\", openSearchArgs);\n} catch (e) {\n  if (String(e).includes(\"dev.password\")) {\n    console.error(\"Add dev.password (or top-level password) to your OpenSearch args for `sst dev`\");\n  }\n  throw e;\n}","preventionTips":["Always set `dev: { password }` when a component supports $dev mode","Set the top-level password once and reuse it for dev and prod","Store the dev password in .env (loaded into sst.config.ts) rather than hardcoding"],"tags":["opensearch","dev-mode","password","configuration"],"backgroundTag":"missing-required-config","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}