Open samberrry opened 1 year ago
two people reported on discord with same error on discord: https://discord.com/channels/770285988244750366/770285988244750370/1068531011668938752
https://discord.com/channels/770285988244750366/770285988244750370/1023931660774932500
Our team suggests doing the following.
Add the file below with the content.
const bodyParser = require('body-parser')
const app = require('express')()
app.use(bodyParser.json())
module. Exports = app
Remember to add them in your nuxt.config.js
Hey @jeffpdotone ,
first I tried it with body-parser.js
and yarn build
ran with error: many Module not found: Error: Can't resolve fs
. I thought the problem is that it should be bound to server-side only, so I changed it to body-parser.server.js
. Code built and ran successfully, however still same error.
[dev:theme] ERROR [VSF][error]: Cache driver thrown an error when invalidating cache! Operation skipped.
[dev:theme]
[dev:theme]
[dev:theme] ERROR [VSF][error]: response.status is not a function
[dev:theme]
[dev:theme] at handler (/Users/Documents/projects/binshops/vuestorefront/prestashop/node_modules/@vue-storefront/cache/nuxt/index.js:32:7)
[dev:theme]
[dev:theme]
[dev:theme] ERROR response.status is not a function
[dev:theme]
[dev:theme] at handler (/Users/Documents/projects/binshops/vuestorefront/prestashop/node_modules/@vue-storefront/cache/nuxt/index.js:39:7)
[dev:theme]
thanks
plugins: [
'~/plugins/body-parser.server.js'
],
content:
const bodyParserServer = require('body-parser');
const app = require('express')();
app.use(bodyParserServer.json());
module.exports = app;
Same problem here using node v14 LTS. We used the library whitout this problem for a long time and didn't have the problem.
Checking node HTTP Response object, the versions 12 14 16 don't have the method .status https://nodejs.org/docs/latest-v14.x/api/http.html
Very strange, probably have plugins or something wrapping the object.
I added the bodyparse on the middleware without errors, but still not solve the .status problem.
Info: The .status come from express https://expressjs.com/pt-br/4x/api.html#res.status .status is a wrapper of .statusCode from HTTP Node response
@samberrry Solved addyng the body parser to server middleware.
The invalidation cache endpoint works!
many thanks @odranoelBR , I will try it and I will update here, hope it solves the issue.
works for me to. Thanks @odranoelBR
@samberrry if you're fine I will close this issue.
Do you think this could be useful to add to docs?
@skirianov I guess a fix in validation handler is necessary,
I do not know how it should be handled, adding the fix snippet in docs or in package.
@samberrry let me add our TL, let's see what they think. @WojtekTheWebDev any ideas what would be the best solution here?
Describe the Bug
We used redis cache driver, and caching is working very well.
When I call the invalidation URL I get error (default invalidation handler):
My cache config:
I use this url to clear redis: http://localhost:3000/cache-invalidate?key=uniqueKey&tags=*
Current behavior
No response
Expected behavior
cache should be cleared after calling this url.
Steps to reproduce
No response
What version of Vue Storefront are you using?
any
What version of Node.js are you using?
any
What browser (and version) are you using?
any
What operating system (and version) are you using?
any
Relevant log output
No response
Able to fix / change the documentation?
Code of Conduct