How check if storyblok service is unavailable?

Hi,

I working in a project that use Nuxt.js and Storyblok to delivery content (menu, images, help content, etc.). For our customer, the availability of the website’s functionalities is more important than its content.

If storyblok service is unavailable for many hours. Are there recommendations or good practices for handling this kind of scenario?

Thanks in the advance!

Hello Patricio,

nice to have you in our forum!

There are two things you can do to prevent that the web-page becomes unavailable:

  1. You can use our official Nuxt.js client that can be installed by using NPM or downloaded directly from Github https://github.com/storyblok/storyblok-nuxt It uses the JS client which brings its own cache with it and will only request data that hasn’t been cached. You can take a look at the documentation of the JS client and the setup instructions here https://github.com/storyblok/storyblok-js-client The source code of it is open so you can study how it works under the hood.
  2. We’re offering two types of content for your work with the data: The draft version of the content that we recommend to use only for the development phase and previewing in the visual editor as it isn’t cached by the CDN and the published version of the content that will be cached after the first request and remains available even when our servers shouldn’t be available when the following requirements are being fulfilled:
    A) You need to use the version parameter with published as the value like this --> version=published to take advantage of the CDN.
    B) You need to use the cv (cache version) parameter in your calls. This value should only be changed when the content changes.
    This can be switched by a webhook --> https://www.storyblok.com/docs/Guides/using-storyblok-webhooks that switches the cache to be flushed and a new cv value being created. An actual cv can be received from the me endpoint as well (Please take a look at the section “cache invalidation” in our documentation under this link https://www.storyblok.com/docs/api/content-delivery#topics/cache-invalidation)
    The for the flush of the cache responsible function (flushCache()) of the JS client is being mentioned in the documentation on Github under this address https://github.com/storyblok/storyblok-js-client#activating-request-cache

Additionally important to know:
The reason for the existence of the cv parameter is that the CDN needs a way to differentiate the different content versions. In the case that you use the delivery API and request stories without the cv value it is well possible that you receive random data and the web app won’t show the actual content. To prevent that you will need to use the cv value as shown in the examples in our documentation --> https://www.storyblok.com/docs/api/content-delivery#core-resources/stories/stories
This shows how to use the version and the cv parameter with correct values that will deliver the data with the best possible performance:
https://api.storyblok.com/v1/cdn/stories/posts/my-third-post?version=published&token=ask9soUkv02QqbZgmZdeDAtt&cv=1560257296

Here is the result of the first time this JSON file has been requested:
The symbol in the red rectangle is showing a cache miss as it hasn’t been requested before and hence not been cached as well.


The second image shows a cache hit:

The assets are cached by our CDN as well. When you use our assets manager or the image service these files are being cached by the CDN as well and delivered with best performance.

You can take a look at this page from Amazon Cloudfront https://aws.amazon.com/de/cloudfront/features/ to see how big the network of nodes is. Amazon Cloudfront is a really reliable CDN and offers a high bandwidth.

If there are any open questions please feel free to ask :slight_smile:

With best regards
Hannes Michaelis - Storyblok Support

@Hannes thanks for you answer. This information is very useful for our team.

If we have more questions we will let you know. Thank again :+1:.

1 Like