PM2 + Node.js + Nginx: no response to a large request

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



PM2 + Node.js + Nginx: no response to a large request



First question, so I apologize if I'm not being clear/specific enough.



I'm currently attempting to serve a React/Express/Node.js app with Nginx and PM2. I set up a reverse proxy with Nginx to serve my Node/Express app, and I used npm run build on my React app to statically serve the React application with Nginx.


npm run build



That's fine, unless anyone really advises against doing that.



I think I'm running into issues with PM2. So I'm using a library called DataTables.net, and that involves sending large JSON responses/requests (for example, I had to set my parameter limit really high to allow this to happen):



app.use(express.urlencoded(
extended: true,
limit: '5mb',
parameterLimit: 10000
));


app.use(express.urlencoded(
extended: true,
limit: '5mb',
parameterLimit: 10000
));



The two applications work fine when I serve my backend using nodemon app.js but I run into issues when I attempt to use pm2 start app.js.


nodemon app.js


pm2 start app.js



On the React frontend, I get the following error: "Failed to load resource: the server responded with a status of 504 (Gateway Time-out)", as well as a "Proxy error" - specifically ECONNRESET



And no error occurs on the backend. I've tried with a single line of JSON, and that seems to be fine. As such, I think it might be because the JSON response that I am attempting to send is too large, and that somewhere in pm2, there is a restriction on this? But I can't really find any documentation that supports this.



Was wondering if anyone knew how to solve this? Let me know if I am not detailed or specific enough! Thanks in advance :)





Have you set the nginx client_max_body_size? stackoverflow.com/questions/28476643/…
– darkterbears
Aug 10 at 21:24









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS