Skip to content

Published responses cached regardless of caching settings #105

Description

@nathobson

Describe the issue you're facing

Responses from the Storyblok API are cached when retrieving published content, even when apiOptions contains a cache type of none.

Reproduction

https://stackblitz.com/edit/withastro-astro-971qsd?file=.env

Steps to reproduce

Using Astro in SSR mode via output: 'server' and the Node adapter in mode: standalone, responses from the Storyblok API are cached when retrieving published content, even when apiOptions contains a cache type of none.

For example, the following call via useStoryblok() will return the cached response, not reflecting any updated (published) content:

const story = await useStoryblok(`cdn/stories/home`, {
    version: "published",
  }
)

I've also tested with the settings as in playground-ssr in the repo, which has the following settings:

apiOptions: {
  cache: {
    clear: "auto",
    type: "memory",
  },
}

This produced the same result.

However, if the exact same useStoryblok() call is set to retrieve drafts, everything updates when the page is refreshed, including draft and published content:

const story = await useStoryblok(`cdn/stories/home`, {
    version: "draft",
  }
)

There appears to be a closed and merged PR from three weeks ago in the storyblok-js-client repo but for whatever reason, this doesn't seem to have fixed the issue in the Storyblok Astro SDK.

Tested with the latest release (v5.0.2) of @storyblok/astro, which appears to contain the latest release of storyblok/storyblok-js-client from looking at the version installed in node_modules.

System Info

System:
    OS: macOS 15.0.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 66.47 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
    npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm
    bun: 1.0.22 - ~/.bun/bin/bun
  Browsers:
    Brave Browser: 130.1.71.114
    Chrome: 129.0.6668.103
    Safari: 18.0.1
    Safari Technology Preview: 18.0

Used Package Manager

npm

Error logs (Optional)

No response

Validations

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions