A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi, I noticed that I get duplicate entries for the same cycle index when running the "SubscriptionBillingCycles" query. The data for both entries is identical except for only one of them has the "editedContract".
Is this expected behaviour or some kind of error?
My query is the following:
query SubscriptionContractsBillingCycles($subscriptionContractId: ID!, $rangeSelector: SubscriptionBillingCyclesDateRangeSelector!) { subscriptionBillingCycles(contractId: $subscriptionContractId, first: 4, reverse: true, billingCyclesDateRangeSelector: $rangeSelector) { __typename nodes { __typename status cycleStartAt cycleEndAt cycleIndex skipped editedContract { __typename customAttributes { key value } lines(first: 15) { __typename nodes { __typename id productId variantId quantity } } } } } }
Which returns:
{ "data": { "subscriptionBillingCycles": { "__typename": "SubscriptionBillingCycleConnection", "nodes": [ { "__typename": "SubscriptionBillingCycle", "status": "UNBILLED", "cycleStartAt": "2023-04-03T12:00:01Z", "cycleEndAt": "2023-04-10T12:00:00Z", "cycleIndex": 2, "skipped": false, "editedContract": null }, { //this is a duplicate except that it has "editedContract" "__typename": "SubscriptionBillingCycle", "status": "UNBILLED", "cycleStartAt": "2023-04-03T12:00:01Z", "cycleEndAt": "2023-04-10T12:00:00Z", "cycleIndex": 2, "skipped": false, "editedContract": { //skipping values ... } } }, { "__typename": "SubscriptionBillingCycle", "status": "UNBILLED", "cycleStartAt": "2023-03-23T13:32:24Z", "cycleEndAt": "2023-04-03T12:00:00Z", "cycleIndex": 1, "skipped": false, "editedContract": null } ] } }, "extensions": { "cost": { "requestedQueryCost": 82, "actualQueryCost": 10, "throttleStatus": { "maximumAvailable": 1000.0, "currentlyAvailable": 990, "restoreRate": 50.0 } } } }
Hey @Cleankitchen would you be able to share an X-Request-ID from the response header for that API call (provided it's within the last 10 days/or another more recent example)? - you shouldn't be getting a duplicate here if the subscription contract wasn't edited (see here for more details on how that works). With that request ID we can take a look in the logs and track down the reason you're seeing this here.
Hope to hear from you soon - thanks!
Al | Shopify Developer Support
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Thank you for your reply. In my case, the subscription contract has been edited, but how does that impact the response of billing cycles? As I mentioned in my initial post only one of the billing cycle objects has an "editedContract" set. Is that then expected behaviour?
X-Request-ID: eaf4459a-f987-4ab2-a6a8-0ce06af3f7d5
This is made on 5th of April