The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: update postgres on the edge.
thorwebdev7bab95fcedd0
diff --git a/examples/edge-functions/supabase/.env.local.example b/examples/edge-functions/supabase/.env.local.exampleindex 0031244f9f3..ed44709092f 100644--- a/examples/edge-functions/supabase/.env.local.example+++ b/examples/edge-functions/supabase/.env.local.example@@ -11,7 +11,8 @@ IPINFO_TOKEN="your https://ipinfo.io token"OPENAI_API_KEY="<YOUR API KEY HERE>"# postgres-on-the-edge-DATABASE_URL=+DB_HOSTNAME=+DB_PASSWORD=# puppeteerPUPPETEER_BROWSERLESS_IO_TOKEN=diff --git a/examples/edge-functions/supabase/functions/import_map.json b/examples/edge-functions/supabase/functions/import_map.jsonindex be4b4d84118..de16ef14e67 100644--- a/examples/edge-functions/supabase/functions/import_map.json+++ b/examples/edge-functions/supabase/functions/import_map.json@@ -11,7 +11,7 @@"stripe": "https://esm.sh/[email protected]?target=deno","sift": "https://deno.land/x/[email protected]/mod.ts","@supabase/supabase-js": "https://esm.sh/@supabase/[email protected]",- "postgres": "https://deno.land/x/[email protected]/mod.ts",+ "postgres": "https://deno.land/x/[email protected]/mod.ts","puppeteer": "https://deno.land/x/[email protected]/mod.ts","React": "https://esm.sh/[email protected]?deno-std=0.177.0","upstash_redis": "https://deno.land/x/[email protected]/mod.ts",diff --git a/examples/edge-functions/supabase/functions/postgres-on-the-edge/index.ts b/examples/edge-functions/supabase/functions/postgres-on-the-edge/index.tsindex 871d24679fe..2c950dfef4a 100644--- a/examples/edge-functions/supabase/functions/postgres-on-the-edge/index.ts+++ b/examples/edge-functions/supabase/functions/postgres-on-the-edge/index.ts@@ -1,11 +1,18 @@-import * as postgres from 'postgres'+import { Pool } from 'postgres'import { serve } from 'std/server'-// Get the connection string from the environment variable "DATABASE_URL"-const databaseUrl = Deno.env.get('DATABASE_URL')!--// Create a database pool with three connections that are lazily established-const pool = new postgres.Pool(databaseUrl, 3, true)+// Create a database pool with one connection.+const pool = new Pool(+ {+ tls: { enabled: false },+ database: 'postgres',+ hostname: Deno.env.get('DB_HOSTNAME'),+ user: 'postgres',+ port: 5432,+ password: Deno.env.get('DB_PASSWORD'),+ },+ 1+)serve(async (_req) => {try {@@ -16,7 +23,6 @@ serve(async (_req) => {// Run a queryconst result = await connection.queryObject`SELECT * FROM animals`const animals = result.rows // [{ id: 1, name: "Lion" }, ...]- console.log(animals)// Encode the result as pretty printed JSONconst body = JSON.stringify(