The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
db: allow public read access to troubleshooting entries table (#33172)
Charisf1e4970352af
diff --git a/apps/docs/features/docs/Troubleshooting.utils.ts b/apps/docs/features/docs/Troubleshooting.utils.tsindex ce613c7ef43..d8cf6d7d5c0 100644--- a/apps/docs/features/docs/Troubleshooting.utils.ts+++ b/apps/docs/features/docs/Troubleshooting.utils.ts@@ -2,8 +2,7 @@ import { cache } from 'react'import { z } from 'zod'import { cache_fullProcess_withDevCacheBust } from '~/features/helpers.fs'-import { IS_PLATFORM } from '~/lib/constants'-import { supabaseAdmin } from '~/lib/supabaseAdmin'+import { supabase } from '~/lib/supabase'import {getAllTroubleshootingEntriesInternal,getArticleSlug as getArticleSlugInternal,@@ -27,10 +26,9 @@ export interface ITroubleshootingEntry {export const getArticleSlug = getArticleSlugInternalasync function getAllTroubleshootingEntriesTyped() {- const result: ITroubleshootingEntry[] = (- IS_PLATFORM ? await getAllTroubleshootingEntriesInternal() : []- ) as ITroubleshootingEntry[]- return result+ const result: ITroubleshootingEntry[] =+ (await getAllTroubleshootingEntriesInternal()) as ITroubleshootingEntry[]+ return result ?? []}export const getAllTroubleshootingEntries = cache_fullProcess_withDevCacheBust(getAllTroubleshootingEntriesTyped,@@ -91,15 +89,11 @@ export async function getAllTroubleshootingErrors() {}async function getTroubleshootingUpdatedDatesInternal() {- if (!IS_PLATFORM) {- return new Map<string, Date>()- }-const databaseIds = (await getAllTroubleshootingEntries()).map((entry) => entry.data.database_id).filter((id) => !id.startsWith('pseudo-'))- const { data, error } = await supabaseAdmin()+ const { data, error } = await supabase().from('troubleshooting_entries').select('id, date_updated').in('id', databaseIds)diff --git a/apps/docs/lib/supabase.ts b/apps/docs/lib/supabase.tsindex 78f371e4b85..ad1f28a7912 100644--- a/apps/docs/lib/supabase.ts+++ b/apps/docs/lib/supabase.ts@@ -1,4 +1,5 @@import { createClient, type SupabaseClient } from '@supabase/supabase-js'+import { type Database as DatabaseGenerated } from 'common'export type Database = {diff --git a/supabase/migrations/20251023193135_anon_read_access_troubleshooting.sql b/supabase/migrations/20251023193135_anon_read_access_troubleshooting.sqlnew file mode 100644index 00000000000..9ba0cb7d1e2--- /dev/null+++ b/supabase/migrations/20251023193135_anon_read_access_troubleshooting.sql@@ -0,0 +1,14 @@+-- Give anon and authenticated read access to the troubleshooting entries table+-- Allows troubleshooting entries to be generated in local dev++create policy anon_read_troubleshooting_entries+on public.troubleshooting_entries+for select+to anon+using (true);++create policy authenticated_read_troubleshooting_entries+on public.troubleshooting_entries+for select+to authenticated+using (true);