Shopify Admin GraphQL API undesired customer cache

Topic summary

A caching bug in Shopify’s Admin GraphQL API causes customer queries by email to return empty results when deleted customers previously used that email address.

Core Issue:

  • When querying customers by email with first: 1, the API returns an empty array even when an active customer exists with that email
  • The problem occurs because deleted customers with the same email are being counted/cached
  • Increasing the first parameter to match the number of previously deleted customers eventually returns the active customer
  • This affects email changes as well—if a customer switches emails, both old and new addresses may return unexpected results

Current Status:

  • Shopify DevSup confirmed they reproduced the issue and escalated to developers
  • The bug only affects GraphQL API, not the REST API
  • Multiple users report this is causing production problems

Temporary Workarounds:

  • Use the REST customers/search.json endpoint instead
  • Add reverse: true to customerConnection query arguments
  • Note: The pageInfo doesn’t return an endCursor for empty nodes even when hasNextPage is true, complicating pagination
Summarized with AI on November 22. AI used: claude-sonnet-4-5-20250929.

Hi all!

I’ve run into an odd issue here searching though customers by their email. Here’s the query:

query GetCustomers($query: String!) {
    customers(query: $query, first: 1) {
        nodes {
            id
            locale
        }
    }
  }

And my input:

{
   "query": "email:sometesting@emailaddress.com"
}

In this case, I’ve used this email address multiple times for testing purposes, meaning I’ve created then deleted an account that was using this email.

So now when I make the query, if the first parameter is set to 1, the API will return an empty array even though there is an actual customer using the queried email address.
If I increment the first parameter, then I will end up getting my customer once I reach the value of the amount of previously deleted customer.

This also happens if a customer first subscribed using a first email address, then changed it. If another customer is created using the initial email address, I will end up retrieving both customers linked to the same email address, even though only one is currently using it.

For information, this doesn’t occur on the REST API, only on the GraphQL admin API.

How could we solve this issue?
It’s important to mention that the email address is the only data available to me on this specific workflow, querying by id is not an option.

Thanks for the help!

2 Likes

Having the same issue here.

Please Shopify Devs, respond to this quickly as this will and has led to production problems.

3 Likes

Hey @MarionOtt ,

Thanks for flagging this.

We were able to reproduce this behaviour, and have already flagged this with our developers.

I can confirm the REST customers/search.json endpoint also works on my test store, but for anyone having these empty nodes cause production problems still using GraphQL:

  • The customerConnection.pageinfo doesn’t return an endCursor for the empty node, but hasNextPage is true.
  • Adding reverse: true to your customerConnection arguments should ensure you get the expected results, regardless of if there’s an empty node in the initial results.
1 Like