The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix(studio): handle null db_pool when creating api schema (#41512)
Vaibhav428700538ae4
diff --git a/apps/studio/data/api-settings/create-and-expose-api-schema-mutation.ts b/apps/studio/data/api-settings/create-and-expose-api-schema-mutation.tsindex 6eca1b957a5..8b66ced7d5c 100644--- a/apps/studio/data/api-settings/create-and-expose-api-schema-mutation.ts+++ b/apps/studio/data/api-settings/create-and-expose-api-schema-mutation.ts@@ -1,6 +1,7 @@import { useMutation, useQueryClient } from '@tanstack/react-query'import { toast } from 'sonner'+import { components } from 'api-types'import { configKeys } from 'data/config/keys'import { databaseKeys } from 'data/database/keys'import { handleError, patch } from 'data/fetchers'@@ -11,13 +12,15 @@ export type CreateAndExposeAPISchemaVariables = {projectRef: stringconnectionString?: string | nullexistingPostgrestConfig: {- db_pool: any+ db_pool?: number | nullmax_rows: numberdb_extra_search_path: stringdb_schema: string}}+type UpdatePostgrestConfigBody = components['schemas']['UpdatePostgrestConfigBody']+export async function createAndExposeApiSchema({projectRef,connectionString,@@ -31,14 +34,17 @@ grant usage on schema api to anon, authenticated;await executeSql({ projectRef, connectionString, sql })const { db_extra_search_path, db_pool, db_schema, max_rows } = existingPostgrestConfig++ const body: UpdatePostgrestConfigBody = {+ max_rows,+ db_extra_search_path,+ db_schema: `api, ${db_schema}`,+ }+ if (db_pool) body.db_pool = db_pool+const { error } = await patch('/platform/projects/{ref}/config/postgrest', {params: { path: { ref: projectRef } },- body: {- db_pool,- max_rows,- db_extra_search_path,- db_schema: `api, ${db_schema}`,- },+ body,})if (error) handleError(error)