storyblok-js-client icon indicating copy to clipboard operation
storyblok-js-client copied to clipboard

Issue with cached data returned in production

Open acelletti opened this issue 10 months ago • 9 comments

We have recently added Storyblok to our portal and upon launching the new Home page, we realised pretty quickly that updates to the home page that we published were not being picked up on our site.

We use Nuxt 3 with @storyblok/nuxt version 6.0.6 (latest).

I have reached out to the help desk a few days ago and they suggested we use a webhook to trigger https://github.com/storyblok/storyblok-js-client#method-storyblokflushcache however this did not work for us as we had not switched the cache in production so it was set to cache: { type: 'none' }.

I have added some debug logs to the storyblok-js client to see what was going on under the hood (attached). debug_logs.txt

From what I can see there are two issues that I would like to address:

  1. We use several machines to host the website, how would we flush the cache for each one using webhooks? The only way that I can think of doing this is to use a shared cache like Redis, but could not find any plugin to do this in Storyblok.

  2. The main issue seems to be that the value of CV is cached in memory under cacheVersions which is not reset by the flushCache command. So effectively even tho we have no cache, the server keeps requesting the same CV which is outdated and there is no way to fix this but to restart the machine. This behavior does not seem to happen on the draft API as this seems to ignore the CV value sent by the client.

  3. What is the point of the cache.clear config? I have set it to both manual and auto for both draft & published and I can see no difference at all in the actual behavior of the client API.

acelletti avatar Apr 09 '24 08:04 acelletti