[bug] Storefront API metafield caching

Hi Shopify team,

TL;DR

Since around 2 weeks we are experiencing a bug with metafields and especially translated metafields. The Storefront API is giving us outdated content, which we believe to be due to caching.

Our Use Case

We use metafields to store custom content of merchants using the Admin API. When we check the Admin API, or Metafields Guru, or Translate & Adapt, we see that the content is properly set.

Problem description

When we query the content using the Storefront API, we get outdated content around 50% of the time. After a few hours, the content becomes updated, but it’s taking very long and sometimes is unpredictable.

We can also reproduce the issue by doing a simple cURL request to the Storefront API where we can see it responding different versions of the same metafield after several tries. This also happens for different translations of the same metafield, when querying using the @inContext directive.

Example query

query($key: String!, $namespace: String!) @inContext(country: DE) {
  shop {
    metafield(key: $key, namespace: $namespace) {
        key
        value
        namespace
    }
  }
}

Hi Ocastx,

Thanks for flagging this issue - I’ll connect with the Storefront API team and see if there’s an issue on our side which would explain this caching/ outdated info problem. I’ll update here when I hear back.

The issue was fixed by Shopify today. It was a caching bug on Shopify EU servers.

https://github.com/Shopify/storefront-api-feedback/discussions/191

Hi,
We are seeing this issue on US stores now. Our app uses metafields for a variety of data and they are essential to our functionality - but right now changes we make (using the API) are not updating on the storefront until we force clear the cache in the browser.
Did something change? Is this the same bug? Can we force them not to cache somehow?

1 Like

Hey Starlynne,

I’d advise creating a discussion in the Storefront API Feedback repository, as provided in the link above. This will help in tracking the bug on Shopify’s end, if there is indeed an API bug.

Hope this helps!

We are still facing exactly same issue while fetching metaobjects from storefront api, this is happening for ASIA servers.

1 Like