Skip to content

Commit c1799b9

Browse files
committed
payments screen
1 parent 3387f3b commit c1799b9

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

packages/dashboard/src/utils/paddle/process-webhook.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
SubscriptionCreatedEvent,
77
SubscriptionUpdatedEvent,
88
} from '@paddle/paddle-node-sdk';
9-
import { createClient } from '../supabase/server';
9+
import { UNSAFE_createAdminClient } from '../supabase/admin';
1010

1111
export 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({
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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+
}

0 commit comments

Comments
 (0)