Pages sometimes 404ing after initial creation via the API?

Highlighted
Tourist
4 0 4

When making calls to the Shopify Create Page API, we'll get back a successful response that looks like:

 

# Note -- pseduocode below
response =  post_to_url("https://example-shop.myshopify.com/admin/api/2020-01/pages.json", params)
response = {
  'id' => 12345678910,
  'title' => 'example-title-here',
  'shop_id' => 12345678910,
  'handle' => 'example-handle',
  'body_html' => '<div>Hello World</div>',
  'author' => 'Shopify API',
  'created_at' => '2020-11-03T09:37:42-05:00',
  'updated_at' => '2020-11-03T09:37:42-05:00',
  'published_at' => '2020-11-03T09:37:42-05:00',
  'template_suffix' => 'example.default',
  'admin_graphql_api_id' => 'gid://shopify/OnlineStorePage/12345678910'
}

 

 

We'll then double check that the page is real by doing an API request to get that specific page, and it returns back normally and says the page is visible.

But afterwards when we go to the page url, e.g. we go to "https://example-shop.myshopify.com/pages/example-handle", there's a ~20% chance that the page will be a 404 for a few seconds. Usually this is quickly resolved (within lets say 10 seconds max), but our flow currently goes:

 

1. Create page via API

2. Verify page created

3. Go to page created 

 

All within a few seconds, and we're getting enough of these 404s happening that it's causing a bit of pain for us.

One thing that I speculate it has to do with something shopify is doing either with caching, or with their new Storefront Renderer, but nothing confirmed.

 

I've tried adding random parameters at the end to try to bust caching, and retrying up to 10 times to go to the page, but it still seems like not enough time before the page actually "shows up" on the store.

 

Anyone else experience this?

0 Likes