{"record":{"id":"628bd95078b3a854","repo":"anomalyco/sst","slug":"proxy-is-not-enabled-enable-it-with-proxy-true-628bd9","errorCode":null,"errorMessage":"Proxy is not enabled. Enable it with \"proxy: true\".","messagePattern":"Proxy is not enabled\\. Enable it with \"proxy: true\"\\.","errorType":"exception","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/postgres.ts","lineNumber":950,"sourceCode":"  }\n\n  /**\n   * The identifier of the Postgres instance.\n   */\n  public get id() {\n    if (this.dev?.enabled) return output(\"placeholder\");\n    return this.instance!.identifier;\n  }\n\n  /**\n   * The name of the Postgres proxy.\n   */\n  public get proxyId() {\n    if (this.dev?.enabled) return output(\"placeholder\");\n\n    return this.proxy!.apply((v) => {\n      if (!v) {\n        throw new VisibleError(\n          `Proxy is not enabled. Enable it with \"proxy: true\".`,\n        );\n      }\n      return v.id;\n    });\n  }\n\n  /** The username of the master user. */\n  public get username() {\n    if (this.dev?.enabled) return this.dev.username;\n    return this.instance!.username;\n  }\n\n  /** The password of the master user. */\n  public get password() {\n    if (this.dev?.enabled) return this.dev.password;\n    return this._password!;\n  }","sourceCodeStart":932,"sourceCodeEnd":968,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/postgres.ts#L932-L968","documentation":"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.","triggerScenarios":"Calling postgres.proxyId (e.g., to wire a Lambda to the proxy) on a component without proxy: true in its args.","commonSituations":"Developers assuming a proxy exists by default; copying example code that references proxyId without enabling the proxy option.","solutions":["Add proxy: true to the Postgres component args","In dev mode, note proxyId returns \"placeholder\" instead and no proxy is created","If a direct connection is fine, use the connection URL instead of proxyId"],"exampleFix":"// before\nconst db = new sst.aws.Postgres(\"MyDb\", {});\nnew sst.aws.Function(\"Fn\", { link: [db], url: true, handler: \"...\", environment: { PROXY: db.proxyId } });\n// after\nconst db = new sst.aws.Postgres(\"MyDb\", { proxy: true });\nnew sst.aws.Function(\"Fn\", { link: [db], url: true, handler: \"...\", environment: { PROXY: db.proxyId } });","handlingStrategy":"validation","validationCode":"const args = { proxy: true } satisfies sst.aws.PostgresArgs;\nif (!args.proxy) throw new Error(\"proxyId requires proxy: true\");\nconst db = new sst.aws.Postgres(\"Db\", args);","typeGuard":"function hasProxy(args: sst.aws.PostgresArgs): args is sst.aws.PostgresArgs & { proxy: true } {\n  return args.proxy === true;\n}","tryCatchPattern":"try {\n  const id = db.proxyId;\n} catch (e) {\n  if (String(e).includes(\"Proxy is not enabled\")) console.error(\"Enable proxy: true on the Postgres component\");\n  throw e;\n}","preventionTips":["Set proxy: true whenever you reference proxyId","Remember proxyId returns \"placeholder\" in dev mode","Prefer connection URL via link unless proxy pooling is required"],"tags":["postgres","rds-proxy","configuration"],"backgroundTag":"feature-not-enabled","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}