Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache option not working #149

Closed
do-web opened this issue Jun 8, 2022 · 3 comments
Closed

Cache option not working #149

do-web opened this issue Jun 8, 2022 · 3 comments

Comments

@do-web
Copy link

do-web commented Jun 8, 2022

If i try to enable cache option:
buildModules: [ ["@storyblok/nuxt", { accessToken: "xxxxx", apiOptions: { cache: { type: "memory" }, }, }] ],

I get an error:
Cannot add property accessToken, object is not extensible

This is also not working:

buildModules: [ ["@storyblok/nuxt", { accessToken: "xxxxx", apiOptions: { accessToken: "xxxxx", cache: { type: "memory" }, }, }] ],

Iam using the latest version.

If i remove the apiOptions property, storyblok creates two request:

301 https://api.storyblok.com/v2/cdn/stories/en?version=published&token=xxxxx&cv=undefined =>
200 https://api.storyblok.com/v2/cdn/stories/en?cv=1654702667&token=xxxxx&version=published

How can i prevent this 301?

@arpadgabor
Copy link

Confirming this issue. Whenever I pass apiOptions to the module it start failing with [nuxt] [request error] Cannot add property accessToken, object is not extensible.

The problematic code seems to be this bit in the storyblokInit function (code taken from dist folder in node_modules):

const { bridge, accessToken, use = [], apiOptions = {} } = pluginOptions;
apiOptions.accessToken = apiOptions.accessToken || accessToken;

@StaffOfHades
Copy link

StaffOfHades commented Oct 10, 2022

This should be fixed as of V4.3.0. Check #170 (comment)

@alvarosabu
Copy link
Contributor

Closing since it hasn't been active in a while and the latest comment from @StaffOfHades. If it's still happening feel free to re-open providing a valid reproduction link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants