Score:0

Getting 502 from Nginx when processing node app

hu flag

I am running an app with react and node that uploads csv files via react, node then converts them to json, processes the data and finally it outputs an excel file using npm exceljs, the whole thing takes a little time on my local environment but it works well.

But when I put it on production I get a 502 error when it's processing the excel file.

There is no much information other than 502, on the nginx error log I get:

`*271 upstream prematurely closed connection while reading response header from upstream`

nginx.conf

sendfile on;
keepalive_timeout  65;
client_max_body_size 12000M;
client_body_buffer_size 1024k;
client_header_timeout 3000;
client_body_timeout 3000;

fastcgi_read_timeout 3000;
fastcgi_buffers 8 1024k;
fastcgi_buffer_size 1024k;
fastcgi_connect_timeout 3000;
fastcgi_send_timeout 3000;

proxy_buffer_size 1024k;
proxy_buffers 4 1024k;
proxy_busy_buffers_size 1024k;

app.conf

location /opSizing/process {
  proxy_pass http://localhost:5006/opSizing/process;
}

enter image description here

cn flag
The "prematurely closed" message suggests a _crash_... Have you checked the upstream application's log? Is there a vast exception dump in there? That, or, maybe, your upstream app just does not speak HTTP properly -- to NGinx' satisfaction...
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.