File tree Expand file tree Collapse file tree
packages/dashboard/src/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 SubscriptionCreatedEvent ,
77 SubscriptionUpdatedEvent ,
88} from '@paddle/paddle-node-sdk' ;
9- import { createClient } from '../supabase/server ' ;
9+ import { UNSAFE_createAdminClient } from '../supabase/admin ' ;
1010
1111export class ProcessWebhook {
1212 async processEvent ( eventData : EventEntity ) {
@@ -23,7 +23,7 @@ export class ProcessWebhook {
2323 }
2424
2525 private async updateSubscriptionData ( eventData : SubscriptionCreatedEvent | SubscriptionUpdatedEvent ) {
26- const supabase = await createClient ( ) ;
26+ const supabase = await UNSAFE_createAdminClient ( ) ;
2727 const { error } = await supabase
2828 . from ( 'subscriptions' )
2929 . upsert ( {
@@ -40,7 +40,7 @@ export class ProcessWebhook {
4040 }
4141
4242 private async updateCustomerData ( eventData : CustomerCreatedEvent | CustomerUpdatedEvent ) {
43- const supabase = await createClient ( ) ;
43+ const supabase = await UNSAFE_createAdminClient ( ) ;
4444 const { error } = await supabase
4545 . from ( 'customers' )
4646 . upsert ( {
Original file line number Diff line number Diff line change 1+ import { createClient } from '@supabase/supabase-js'
2+ import { env } from "next-runtime-env" ;
3+
4+ export async function UNSAFE_createAdminClient ( ) {
5+
6+ return createClient (
7+ env ( 'NEXT_PUBLIC_SUPABASE_URL' ) ! ,
8+ process . env . SUPABASE_SERVICE_ROLE ! ,
9+ )
10+ }
You can’t perform that action at this time.
0 commit comments