What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

[bug] Storefront API metafield caching

Solved

[bug] Storefront API metafield caching

ocastx
Shopify Partner
31 6 12

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
    }
  }
}



 

Accepted Solution (1)

ocastx
Shopify Partner
31 6 12

This is an accepted solution.

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

View solution in original post

Replies 5 (5)

Liam
Community Manager
3108 344 895

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. 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me 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

ocastx
Shopify Partner
31 6 12

This is an accepted solution.

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

Starlynne
Shopify Partner
8 0 6

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? 

ocastx
Shopify Partner
31 6 12

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!

elnormarc
Shopify Partner
7 0 4

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