graphql query returning no orders even though some exist that match criteria

rbmdotdev
Tourist
5 0 2

Hi, I am having trouble with the graphql api all of a sudden against a specific dev store I am using.

When I run the following query in the shopify graphql explorer installed on my store it returns the expected results. when I run the exact same query from my app server it returns as if there are no orders. It does not error but specifically returns successfully just with no orders

What reasons are there that would cause the same query to return different results depending on where its being called?

 

Edit: it appears to be something to do the offline token I am using.  When I force the gql client to use the online token I get the expected results.  When I use the offline token generated at shopify app install time (by the same user who owns the online token fwiw) I get a successful response but no orders in the response

 

 

   {
        orders(
            first:10
            query:"fulfillment_status:unfulfilled AND financial_status:paid AND cancelled_at:null AND status:open"
        ) {
            edges {
                cursor
                node {
                        id
                        name
                        displayFulfillmentStatus
                        cancelledAt
                        lineItems(first: 30) {
                        edges {
                            node {
                                id
                                title
                                fulfillmentStatus
                            }
                        }
                    }
                }
            }
            pageInfo {
                hasNextPage
                hasPreviousPage
            }
        }
    }

 

 

Replies 3 (3)

rbmdotdev
Tourist
5 0 2

it appears to be something related to the part of the query string fulfillment_status: unfulfilled when I remove that part of the query on the server the query gets results when its included it does not get results.  This store has 12 unfulfilled orders, the graphql explorer app returns those 12 orders when I run the query including that filter as expected

rbmdotdev
Tourist
5 0 2

looks like the cause is the fact that by default you only get access to the last 60 days worth of orders and the orders in my test shop are older than 60 days and I guess that the graphql explorer app gets special permissions as its able to see them in the same query.

 

very annoying

now to try and figure out a way around this limitation

Luke_K
Shopify Staff
402 66 98

Hey @rbmdotdev 

For what it's worth, I know upon installation, the Shopify GraphiQL App Installer only gives the option to add read_all_orders. So that could explain the discrepancy in the results you're seeing.

It's possible to request access to read_all_orders scope this way(docs). Hope that helps!

 

 

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!