Api/stock/list request returns 500


i’m stuck on this problem that i often get 500er server response for the api/stock/list request. The error appears very differntly to the requested urls, Sometimes they work and sometimes they don’t. If i do a single request to those links i get a working response. Error Logs showing me nothing to this problem.

my mistake, i had a look in the api logs again and found this error. can anybody please help and explain how to debug this to find whats the cause? i know this problem from php but dont know how to debug this in node cli

5|api | (node:17316) UnhandledPromiseRejectionWarning: Error: Can’t set headers after they are sent.
5|api | at validateHeader (_http_outgoing.js:491:11)
5|api | at ServerResponse.setHeader (_http_outgoing.js:498:3)
5|api | at ServerResponse.header (/kunden/600990_79713/webseiten/vuesf/api/node_modules/express/lib/response.js:771:10)
5|api | at ServerResponse.send (/kunden/600990_79713/webseiten/vuesf/api/node_modules/express/lib/response.js:170:12)
5|api | at ServerResponse.json (/kunden/600990_79713/webseiten/vuesf/api/node_modules/express/lib/response.js:267:15)
5|api | at Object.apiStatus (/kunden/600990_79713/webseiten/vuesf/api/src/lib/util.js:45:19)
5|api | at Promise.all.catch.then (/kunden/600990_79713/webseiten/vuesf/api/src/api/stock.js:86:4)
5|api | at
5|api | at process._tickDomainCallback (internal/process/next_tick.js:228:7)
5|api | (node:17316) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 13)

@steffen-wirth Hey :slight_smile: Can you tell which vsf-api version do you use?

Hi i’m using api 1.10 with some changes from 1.11 to get the Frontend with v. 1.11. Running. API connects to Mage 1. The Stock list function uses promises.all so if there is only one error the whole response is a 500. I did some logging in the Mage 1 Stock Controller but im getting no error. Perhaps error is catched somewhere else. But strange as it is if i call the Links directly in the Browser im getting back the full json.

after some changes to stock.js in api i can get all Promises if rejected or not and the output in network tab is like the following

the reason was Apache Timeout Limits :disappointed_relieved: