Why isn't my GraphQL barcode query finding any variants?

Hello, I’m using this GraphQL query (version: 2021-07) to find variants with a barcode.
However, it’s not finding any variants, even though I know and have checked that about 10 variants in my account with barcodes assigned.
it had been working initially but now has stopped working, it sometimes gives result and gives empty response sometimes.
So I don’t know if there are some stale caches or indexing issues in Shopify. Can anyone help clarify what this issue is?

GraphQL sample →

{
              productVariants(first: 1, query: "barcode:#{barcode}") {
                edges {
                  node {
                    id
                    barcode
                    image {
                      id
                    }
                    inventoryItem {
                      id
                    }
                    product {
                      id
                      featuredImage {
                        id
                      }
                    }
                   }
                 }
               }
            }

Hello,

I have the same problem.
However, this is not the case for all the products …
I can’t understand …

query {
  productVariants(first: 10, query: "barcode:123456789") {
    edges {
      node {
        id
        title
        product{
          id  
           images(first:10) {
               edges{
                   node{
                       id
                        originalSrc
                        src
                   }
               }
          }
        }
         image {
            id
            originalSrc
            src
          }
      }
    }
  }
}

Hello!

Wondering if you ever came to a resolution with this or found a new path forward? I am experiencing the same issue and trying to see if this query may still be unreliable and to try to query off products instead? I am trying to prevent having to do this as there is no way to filter the variants that come back with products when querying off barcode :slightly_frowning_face: