From d8223f579683aee7c215414a4fbcc532f844ab64 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 15 Oct 2024 15:19:52 -0400 Subject: [PATCH] Postgres: fix type for host --- examples/internal/playground/sst.config.ts | 12 ++++++++++++ platform/src/components/aws/postgres.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/examples/internal/playground/sst.config.ts b/examples/internal/playground/sst.config.ts index 9668558d4..b38cb4ba3 100644 --- a/examples/internal/playground/sst.config.ts +++ b/examples/internal/playground/sst.config.ts @@ -16,6 +16,7 @@ export default $config({ //const apiv2 = addApiV2(); //const app = addFunction(); //const service = addService(); + //const postgres = addPostgres(); //const cron = addCron(); return ret; @@ -77,5 +78,16 @@ export default $config({ return service; } + + function addPostgres() { + const postgres = new sst.aws.Postgres("MyPostgres", { + vpc, + }); + ret.pgHost = postgres.host; + ret.pgPort = postgres.port; + ret.pgUsername = postgres.username; + ret.pgPassword = postgres.password; + return postgres; + } }, }); diff --git a/platform/src/components/aws/postgres.ts b/platform/src/components/aws/postgres.ts index e66b42e67..4040499bd 100644 --- a/platform/src/components/aws/postgres.ts +++ b/platform/src/components/aws/postgres.ts @@ -565,7 +565,7 @@ export class Postgres extends Component implements Link.Linkable { */ public get host() { return all([this.instance.endpoint, this.proxy]).apply( - ([endpoint, proxy]) => proxy?.endpoint ?? endpoint.split(":")[0], + ([endpoint, proxy]) => proxy?.endpoint ?? output(endpoint.split(":")[0]), ); }