A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi,
I am facing an issue with graphql query.
This is the query:
orders(first: 10, sortKey: UPDATED_AT, query: $queryString, after: $orderCursor, reverse: false)
"updated_at:>='2023-03-26T23:40:07Z' AND updated_at:<='2023-03-31T22:31:36Z' AND status:open AND -fulfillment_status:on_hold"
"data": { "orders": { "nodes": [], "pageInfo": { "hasNextPage": true, "hasPreviousPage": false, "startCursor": null, "endCursor": null } } }
Hey @Navjot_RC this does seem odd, thanks for getting in touch. I have a few answers to your questions and some follow up, if that's helps!
1. This is odd and doesn't seem expected based on the API behaviour I am familiar with. I noticed you are using the reverse query filter here with a false value. This is how Shopify carriers out queries by default, so this doesn't need to be included in the query. I can't say for certain if this is what is causing the error here, but can you try removing that field and letting us know if it resolves the query?
For questions 2-4, to clarify without going too in depth, Shopify doesn't first pull all of the orders and the apply the filter, rather, it iterates through them using a relational structure based on the query parameters and then serves them to you that way via the API. More info here if you're interested in how our database infrastructure works. To answer your last question there, you should be able to use updated_at the same way - so it is odd that you're getting a null value for the cursor.
Could you share an X-Request-ID from a Shopify response header? Happy to dig into this further with you, if you haven't solved the issue. From what I can tell, this is unexpected behaviour.
Hope this helps and hope to hear from you soon - definitely happy to dig into this more if need be.
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 response. I still haven't been able to solve the issue.
I tried removing the reverse query filter but still got same response.
Here's the X-Request-ID: 5c11120f-e7cd-4593-bad6-5552860a6234
Hey @Navjot_RC - thank you for waiting on a reply here, I am still looking into this for you. This is certainly odd. The only thing that I think could be likely based on taking a look at the logs I pulled using that ID is that there are no orders with the "open" status available to be queried for that time period. From what you've said that doesn't seem like it's the case though, so I have a few next steps.
Could you reach out to our Partner Support team if you haven't already? We'll likely need to take a look at the specific store to troubleshoot further and will either need the merchant to approve a collaborator account for you, or if you are using a test store, we would need to authenticate you as the store owner that way.
I would share this forum thread in your message to Partner Support and let them know that the Developer Support Team suggested you get in touch that way - you can access their support channels through the little "Support" button in your Partner Organization's dashboard. Our Partner Support team can get in touch with our more technical teams who can then troubleshoot directly on the store and share findings with partner support once you've either been approved as a collaborator by the merchant or if we've authenticated you as the store owner. I'll include some notes on my end internally that we can share with the Partner Support team as well.
Hope this helps and thanks again for reaching out.
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