anomalyco/sst · error · VisibleError

You must provide the password to connect to your locally run

Error message

You must provide the password to connect to your locally running Postgres database either by setting the "dev.password" or by setting the top-level "password" property.

What it means

When a Postgres component runs in dev mode ($dev is true), SST connects to a locally running Postgres via RDS Proxy, which requires the database password. The password must be supplied either as args.dev.password or as the top-level args.password; if neither is set, the component throws this VisibleError during registerDev.

Source

Thrown at platform/src/components/aws/postgres.ts:634

      if (args.vpc instanceof Vpc) {
        return {
          subnets: args.vpc.privateSubnets,
        };
      }

      // "vpc" is object
      return output(args.vpc);
    }

    function registerDev() {
      if (!args.dev) return undefined;

      if (
        $dev &&
        args.dev.password === undefined &&
        args.password === undefined
      ) {
        throw new VisibleError(
          `You must provide the password to connect to your locally running Postgres database either by setting the "dev.password" or by setting the top-level "password" property.`,
        );
      }

      const dev = {
        enabled: $dev,
        host: output(args.dev.host ?? "localhost"),
        port: output(args.dev.port ?? 5432),
        username: args.dev.username ? output(args.dev.username) : username,
        password: output(args.dev.password ?? args.password ?? ""),
        database: args.dev.database ? output(args.dev.database) : dbName,
      };

      new DevCommand(`${name}Dev`, {
        dev: {
          title: name,
          autostart: true,
          command: `sst print-and-not-quit`,

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Set the password in the dev block: dev: { password: "..." }
  2. Or set the top-level password property on the Postgres component args
  3. Move the existing prod password into shared args so both paths use it

Example fix

// before
new sst.aws.Postgres("MyDb", { dev: true });
// after
new sst.aws.Postgres("MyDb", {
  dev: { password: "local-password" },
  password: "prod-password",
});
Defensive patterns

Strategy: validation

Validate before calling

const devEnabled = args.dev !== undefined;
if (devEnabled && args.dev?.password === undefined && args.password === undefined) {
  throw new Error("Provide dev.password or password for Postgres dev mode");
}

Type guard

function hasDevPassword(args: sst.aws.PostgresArgs): boolean {
  return args.password !== undefined || args.dev?.password !== undefined;
}

Try / catch

try {
  const db = new sst.aws.Postgres("Db", args);
} catch (e) {
  if (String(e).includes("password")) console.error("Set dev.password or password for dev mode");
  throw e;
}

Prevention

When it happens

Trigger: Declaring a Postgres component with dev: true (or running `sst dev --mode=basic` with dev enabled) while both args.dev.password and args.password are undefined.

Common situations: Developers enabling dev mode on an existing Postgres component that only relied on RDS-managed master credentials; migrating from prod-only config to `sst dev`; forgetting to pass password in the dev block.

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


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