From eaa1c518d87d74ff6f6438d23026744b885b7afe Mon Sep 17 00:00:00 2001 From: Ramnique Singh <30795890+ramnique@users.noreply.github.com> Date: Mon, 18 Aug 2025 15:09:12 +0530 Subject: [PATCH] add debug logs for billing --- apps/rowboat/app/lib/billing.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/rowboat/app/lib/billing.ts b/apps/rowboat/app/lib/billing.ts index 70a8b4bf..e0c7ffce 100644 --- a/apps/rowboat/app/lib/billing.ts +++ b/apps/rowboat/app/lib/billing.ts @@ -12,6 +12,8 @@ import { IProjectsRepository } from '@/src/application/repositories/projects.rep const BILLING_API_URL = process.env.BILLING_API_URL || 'http://billing'; const BILLING_API_KEY = process.env.BILLING_API_KEY || 'test'; +let logCounter = 1; + const GUEST_BILLING_CUSTOMER = { _id: "guest-user", userId: "guest-user", @@ -136,7 +138,8 @@ export async function authorize(customerId: string, request: z.infer) { - console.log(`logging billing usage for customer ${customerId}`, JSON.stringify(request)); + const reqId = logCounter++; + console.log(`[${reqId}] logging billing usage for customer ${customerId} to ${BILLING_API_URL}`, reqId, JSON.stringify(request)); const response = await fetch(`${BILLING_API_URL}/api/customers/${customerId}/log-usage`, { method: 'POST', headers: { @@ -145,6 +148,7 @@ export async function logUsage(customerId: string, request: z.infer