microsoft / azure-api-management-monetization

MIT License
54 stars 30 forks source link

Infinite loop in Stripe billing service #59

Closed joelbudu closed 10 months ago

joelbudu commented 11 months ago

https://github.com/microsoft/azure-api-management-monetization/blob/83fdd04ff5bff15318e3240ddb9c35c019ac53d9/app/src/services/stripeBillingService.ts#L102 https://github.com/microsoft/azure-api-management-monetization/blob/83fdd04ff5bff15318e3240ddb9c35c019ac53d9/app/src/services/stripeBillingService.ts#L92-L94

Hello, Looks like there's a bug in the stripeBillingService where the startingAfter = stripeSubscription.id never runs if usageUnits is 0 in the lines preceding. That line is critical to retrieve the next page of subscriptions from Stripe

This then a never ending loop. I think the startingAfter = stripeSubscription.id should be right at the beginning of the stripeSubscriptionListResponse.data.forEach function