The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix(tickets): use service role key server side (#22585)
Alaister Young1d37e5bcd590
diff --git a/apps/www/lib/supabaseMiscAdmin.ts b/apps/www/lib/supabaseMiscAdmin.tsnew file mode 100644index 00000000000..2a9791fed85--- /dev/null+++ b/apps/www/lib/supabaseMiscAdmin.ts@@ -0,0 +1,11 @@+import { createClient } from '@supabase/supabase-js'+import { Database } from './database.types'++const supabaseMiscAdmin = createClient<Database>(+ process.env.NEXT_PUBLIC_MISC_USE_URL!,+ process.env.MISC_USE_SERVICE_ROLE_KEY!+)++export type SupabaseClient = typeof supabaseMiscAdmin++export default supabaseMiscAdmindiff --git a/apps/www/pages/special-announcement/tickets/[username].tsx b/apps/www/pages/special-announcement/tickets/[username].tsxindex 8d626a1e0fe..d541a679b29 100644--- a/apps/www/pages/special-announcement/tickets/[username].tsx+++ b/apps/www/pages/special-announcement/tickets/[username].tsx@@ -8,6 +8,7 @@ import { Session } from '@supabase/supabase-js'import { Button } from 'ui'import { SITE_URL, SPECIAL_ANNOUNCEMENT_URL } from '~/lib/constants'import supabase from '~/lib/supabaseMisc'+import supabaseMiscAdmin from '~/lib/supabaseMiscAdmin'import dayjs from 'dayjs'import DefaultLayout from '~/components/Layouts/Default'@@ -125,7 +126,7 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {// fetch a specific userif (username) {- const { data } = await supabase!+ const { data } = await supabaseMiscAdmin!.from('lw11_tickets_platinum').select('name, username, ticketNumber, metadata, platinum, secret').eq('username', username)