Mario Schrattenecker
AAlokai
•Created by Mario Schrattenecker on 6/6/2023 in #🙋|general-help
Server Middleware - Express.JS body size limit
Running out of time, I did forgo the attempt to try and change the body size limit of the ExpressJS that results from using the @vue-storefront/middleware/nuxt.
I have not found a possibility to change what I needed to, since the first appearance in the stack of the ExpressJS Server of the json parser could not be changed and remained with a limit of 100kb.
Only option would have been to host our own express, seperated from the nuxt js connect.
I went with seperating the data into smaller chunks and sending it seperately to our server to avoid to big an amount on data.
@.rohrig I think this can be closed since I went with a workaround that is good enougth.
32 replies
AAlokai
•Created by Mario Schrattenecker on 6/6/2023 in #🙋|general-help
Server Middleware - Express.JS body size limit
@here
Returning here, since I still did not find a working solution yet.
I checked several things and found the following:
It seems like the issue is connected to the "createServer" function from @vue-storefront/middleware package(?).
Looking at the source code inside there, the expressjs it creates uses so it uses the defaults.
Manually changing that line inside the package to use the mentioned lets me pass the json which exceeds the 100kb default limit.
I tried to have the extension I am already using in the custom integration, extend the ExpressJS via the "extendApp" function and have the "app" passed to that run the , still to no avail.
The middleware is definitely run as an extension of the underlying Nuxt Server.
Inside the nuxt.config.js it uses the following settings:
Inside the modules array are more entries, but I did not include those here.
Apparently I can not pass any seperate options to the ExpressJS` parser for json when using the vue-storefront/middleware standard to run it?
Which I would find strange since the documentation states that the "extendApp" function receives an "app" parameter that is an "Express" (https://docs.vuestorefront.io/v2/reference/api/core.apiclientextension.extendapp.html)
I am sorry to bother you again with it but I am lost currently.
32 replies
AAlokai
•Created by Mario Schrattenecker on 6/6/2023 in #🙋|general-help
Server Middleware - Express.JS body size limit
I will post here what finally worked once I figured it out.
32 replies
AAlokai
•Created by Mario Schrattenecker on 6/6/2023 in #🙋|general-help
Server Middleware - Express.JS body size limit
Okay, okay^^
I will check my options and just go with what ultimately works.
Thank you for your time.
32 replies
AAlokai
•Created by Mario Schrattenecker on 6/6/2023 in #🙋|general-help
Server Middleware - Express.JS body size limit
Okay, I went and checked some things again.
Checking the nuxt config file, it seems the middleware is run as an extension to the nuxt connect server.
Would you suggest to host the middleware as a seperate process than?
32 replies
AAlokai
•Created by Mario Schrattenecker on 6/6/2023 in #🙋|general-help
Server Middleware - Express.JS body size limit
No, we do that ourselves since we have multiple instances of our product running on different servers and each could have a connection to their respective VSF instance.
32 replies
AAlokai
•Created by Mario Schrattenecker on 6/6/2023 in #🙋|general-help
Server Middleware - Express.JS body size limit
We are not an enterprise customer, no.
Why are you asking?
I checked for the .listen() already in the "api-client" package.
What that package provides though is the index.server.ts file.
As far as I know this file provides the client (in our case axios) for the communication with an external API.
That file exports the following:
32 replies
AAlokai
•Created by Mario Schrattenecker on 6/6/2023 in #🙋|general-help
Server Middleware - Express.JS body size limit
I somehow get the feeling that my predecessor who setup the project base, made some interresting choices here if you do not recognize that setup?
32 replies
AAlokai
•Created by Mario Schrattenecker on 6/6/2023 in #🙋|general-help
Server Middleware - Express.JS body size limit
The package.json contains only one start
32 replies
AAlokai
•Created by Mario Schrattenecker on 6/6/2023 in #🙋|general-help
Server Middleware - Express.JS body size limit
I did not have a middleware.js file, only a middleware.config.js file in the project.
The .config contains this (replace some of those with specific names of course)
From what I can gather, the documentation tells me, that if I create a middleware.js file it will enable me to run the server as a seperate process and configure that.
This, was not in the project up until now.
32 replies
AAlokai
•Created by Mario Schrattenecker on 6/6/2023 in #🙋|general-help
Server Middleware - Express.JS body size limit
Thanks, I guess I will need to give it a shoot to seperate the server middleware from nuxt.
32 replies
AAlokai
•Created by Mario Schrattenecker on 6/6/2023 in #🙋|general-help
Server Middleware - Express.JS body size limit
If you e refering to the "Seperating.." section I wanted to avaoid doing that and stick as close to the standard as possible.
32 replies
AAlokai
•Created by Mario Schrattenecker on 6/6/2023 in #🙋|general-help
Server Middleware - Express.JS body size limit
and still it did not change the fact I received the same error when testing.
Debugging that showed me that indeed it seemed to consume this configuration.
And I am a bit lost which app.listen you are refering to?
32 replies
AAlokai
•Created by Mario Schrattenecker on 6/6/2023 in #🙋|general-help
Server Middleware - Express.JS body size limit
Hi @.rohrig ,
I tried the following:
I went to change my middleware.config.js file in the project root and added an extension, that had only the properties "name" and "extendApp".
The "extendApp" function had the following form
32 replies