From f734b179a99a97c2a5b86fdb7deb0fef4de05e8e Mon Sep 17 00:00:00 2001 From: andrewwallacespeckle Date: Fri, 14 Mar 2025 10:12:57 +0000 Subject: [PATCH] Improve "Open billing portal" logging --- .../frontend-2/lib/billing/composables/actions.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/frontend-2/lib/billing/composables/actions.ts b/packages/frontend-2/lib/billing/composables/actions.ts index 1f63d02bf..82cea6fde 100644 --- a/packages/frontend-2/lib/billing/composables/actions.ts +++ b/packages/frontend-2/lib/billing/composables/actions.ts @@ -48,9 +48,13 @@ export const useBillingActions = () => { const { mutate: cancelCheckoutSessionMutation } = useMutation( settingsBillingCancelCheckoutSessionMutation ) + const logger = useLogger() const billingPortalRedirect = async (workspaceId: MaybeNullOrUndefined) => { - if (!workspaceId) return + if (!workspaceId) { + logger.error('[Billing Portal] No workspaceId provided, returning early') + return + } mixpanel.track('Workspace Billing Portal Button Clicked', { // eslint-disable-next-line camelcase @@ -66,6 +70,11 @@ export const useBillingActions = () => { if (result.data?.workspace.customerPortalUrl) { window.open(result.data.workspace.customerPortalUrl, '_blank') + } else { + logger.warn( + '[Billing Portal] No portal URL returned, full response:', + result.data + ) } }