From d841f9cb621c6d881039130486e7e1266f856883 Mon Sep 17 00:00:00 2001 From: Faruk AYDIN Date: Tue, 28 Mar 2023 00:27:43 +0300 Subject: [PATCH] fix: Do not return invoices if there is no subscription --- packages/backend/src/graphql/queries/get-invoices.ee.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/backend/src/graphql/queries/get-invoices.ee.ts b/packages/backend/src/graphql/queries/get-invoices.ee.ts index 527eed08..c745a4c6 100644 --- a/packages/backend/src/graphql/queries/get-invoices.ee.ts +++ b/packages/backend/src/graphql/queries/get-invoices.ee.ts @@ -7,6 +7,11 @@ const getInvoices = async ( context: Context ) => { const subscription = await context.currentUser.$relatedQuery('subscription'); + + if (!subscription) { + return; + } + const invoices = await Billing.paddleClient.getInvoices( Number(subscription.paddleSubscriptionId) );