'downloaded generated files fails on Elastic bean stalk production
in my API i'm generating an Excel file and the attempt to download it using the following code
const columns = [
{ header: "Id", key: "id", width: 5 },
{ header: "Name", key: "name", width: 15 },
{ header: "Status", key: "status", width: 5 },
];
const workBook = generateExcel(project.name, columns, data);
res.setHeader(
"Content-Type",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
res.setHeader(
"Content-Disposition",
`attachment; filename=${project.name}.xlsx`
);
const tempPath = tempFile('.xlsx')
return workBook.xlsx.writeFile(tempPath).then(() => res.sendFile(tempPath));
and it working perfectly fine locally but one i deploy it to AWS Elasticbeanstalk the request returns 504 time Out and this is the logs i got
----------------------------------------
/var/log/web.stdout.log
----------------------------------------
Feb 19 11:15:48 ip-172-31-9-202 web: > [email protected] start /var/app/current
Feb 19 11:15:48 ip-172-31-9-202 web: > node server.js
Feb 19 11:15:50 ip-172-31-9-202 web: Server Running on http://localhost:8080
Feb 19 11:15:50 ip-172-31-9-202 web: Database connected
Feb 19 13:46:53 ip-172-31-9-202 web: PassThrough {
Feb 19 13:46:53 ip-172-31-9-202 web: _readableState: ReadableState {
Feb 19 13:46:53 ip-172-31-9-202 web: objectMode: false,
Feb 19 13:46:53 ip-172-31-9-202 web: highWaterMark: 16384,
Feb 19 13:46:53 ip-172-31-9-202 web: buffer: BufferList { head: null, tail: null, length: 0 },
Feb 19 13:46:53 ip-172-31-9-202 web: length: 0,
Feb 19 13:46:53 ip-172-31-9-202 web: pipes: [],
Feb 19 13:46:53 ip-172-31-9-202 web: flowing: null,
Feb 19 13:46:53 ip-172-31-9-202 web: ended: false,
Feb 19 13:46:53 ip-172-31-9-202 web: endEmitted: false,
Feb 19 13:46:53 ip-172-31-9-202 web: reading: false,
Feb 19 13:46:53 ip-172-31-9-202 web: sync: false,
Feb 19 13:46:53 ip-172-31-9-202 web: needReadable: false,
Feb 19 13:46:53 ip-172-31-9-202 web: emittedReadable: false,
Feb 19 13:46:53 ip-172-31-9-202 web: readableListening: false,
Feb 19 13:46:53 ip-172-31-9-202 web: resumeScheduled: false,
Feb 19 13:46:53 ip-172-31-9-202 web: errorEmitted: false,
Feb 19 13:46:53 ip-172-31-9-202 web: emitClose: true,
Feb 19 13:46:53 ip-172-31-9-202 web: autoDestroy: true,
Feb 19 13:46:53 ip-172-31-9-202 web: destroyed: false,
Feb 19 13:46:53 ip-172-31-9-202 web: errored: null,
Feb 19 13:46:53 ip-172-31-9-202 web: closed: false,
Feb 19 13:46:53 ip-172-31-9-202 web: closeEmitted: false,
Feb 19 13:46:53 ip-172-31-9-202 web: defaultEncoding: 'utf8',
Feb 19 13:46:53 ip-172-31-9-202 web: awaitDrainWriters: null,
Feb 19 13:46:53 ip-172-31-9-202 web: multiAwaitDrain: false,
Feb 19 13:46:53 ip-172-31-9-202 web: readingMore: false,
Feb 19 13:46:53 ip-172-31-9-202 web: dataEmitted: false,
Feb 19 13:46:53 ip-172-31-9-202 web: decoder: null,
Feb 19 13:46:53 ip-172-31-9-202 web: encoding: null,
Feb 19 13:46:53 ip-172-31-9-202 web: [Symbol(kPaused)]: null
Feb 19 13:46:53 ip-172-31-9-202 web: },
any clues what is causing this problem i made sure that my local development environment is an exact replica from my production server in terms of the node version.
node.jsamazon-web-services">
amazon-web-servicesexpressamazon-elastic-beanstalk">
amazon-elastic-beanstalkexceljs
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
