anomalyco/sst · error · VisibleError

Proxy is not enabled. Enable it with "proxy: true".

Error message

Proxy is not enabled. Enable it with "proxy: true".

What it means

The proxyId getter only returns a valid RDS Proxy id when the Postgres component was created with proxy: true (and is not in dev mode). If the proxy was never created, accessing proxyId throws this VisibleError.

Source

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

  }

  /**
   * The identifier of the Postgres instance.
   */
  public get id() {
    if (this.dev?.enabled) return output("placeholder");
    return this.instance!.identifier;
  }

  /**
   * The name of the Postgres proxy.
   */
  public get proxyId() {
    if (this.dev?.enabled) return output("placeholder");

    return this.proxy!.apply((v) => {
      if (!v) {
        throw new VisibleError(
          `Proxy is not enabled. Enable it with "proxy: true".`,
        );
      }
      return v.id;
    });
  }

  /** The username of the master user. */
  public get username() {
    if (this.dev?.enabled) return this.dev.username;
    return this.instance!.username;
  }

  /** The password of the master user. */
  public get password() {
    if (this.dev?.enabled) return this.dev.password;
    return this._password!;
  }

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Add proxy: true to the Postgres component args
  2. In dev mode, note proxyId returns "placeholder" instead and no proxy is created
  3. If a direct connection is fine, use the connection URL instead of proxyId

Example fix

// before
const db = new sst.aws.Postgres("MyDb", {});
new sst.aws.Function("Fn", { link: [db], url: true, handler: "...", environment: { PROXY: db.proxyId } });
// after
const db = new sst.aws.Postgres("MyDb", { proxy: true });
new sst.aws.Function("Fn", { link: [db], url: true, handler: "...", environment: { PROXY: db.proxyId } });
Defensive patterns

Strategy: validation

Validate before calling

const args = { proxy: true } satisfies sst.aws.PostgresArgs;
if (!args.proxy) throw new Error("proxyId requires proxy: true");
const db = new sst.aws.Postgres("Db", args);

Type guard

function hasProxy(args: sst.aws.PostgresArgs): args is sst.aws.PostgresArgs & { proxy: true } {
  return args.proxy === true;
}

Try / catch

try {
  const id = db.proxyId;
} catch (e) {
  if (String(e).includes("Proxy is not enabled")) console.error("Enable proxy: true on the Postgres component");
  throw e;
}

Prevention

When it happens

Trigger: Calling postgres.proxyId (e.g., to wire a Lambda to the proxy) on a component without proxy: true in its args.

Common situations: Developers assuming a proxy exists by default; copying example code that references proxyId without enabling the proxy option.

Related errors


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