TruBudget
TruBudget copied to clipboard
excel-export: Promise rejection if token invalid or api not reachable SP 2
- [x] I have searched the issues of this repository and believe that this is not a duplicate.
Description 😯
excel-export fails with following error if api cannot be reached:
[2022-04-22 14:57:39.178 +0000] ERROR (Excel-Export-Service on CPX-Z14FUDAJ0LV): Error validating token
err: {
"message": "connect ECONNREFUSED 127.0.0.1:8081",
"stack":
Error: connect ECONNREFUSED 127.0.0.1:8081
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16)
"config": {
"url": "http://127.0.0.1:8081/api/version",
"method": "get",
"headers": {
"Accept": "application/json, text/plain, */*",
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJyb290IiwiYWRkcmVzcyI6IjFhZDM1OHRudVR2UWQ5V3BIUUxQWG1yWXQ5U2VwcGl3UFFOZ05MIiwib3JnYW5pemF0aW9uIjoiTXlPcmdhIiwib3JnYW5pemF0aW9uQWRkcmVzcyI6IjFhZDM1OHRudVR2UWQ5V3BIUUxQWG1yWXQ5U2VwcGl3UFFOZ05MIiwiZ3JvdXBzIjpbXSwiaWF0IjoxNjUwNjM5NDU1LCJleHAiOjE2NTA2NjgyNTV9.DyQzikfyKSO0hZ48g37QJPTzuHeZA7q0FzR0H3gnGqs",
"User-Agent": "axios/0.21.4"
},
"transformRequest": [
null
],
"transformResponse": [
null
],
"timeout": 0,
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
"maxContentLength": -1,
"maxBodyLength": -1,
"transitional": {
"silentJSONParsing": true,
"forcedJSONParsing": true,
"clarifyTimeoutError": false
}
},
"code": "ECONNREFUSED"
}
[2022-04-22 14:57:39.180 +0000] FATAL (Excel-Export-Service on CPX-Z14FUDAJ0LV): UNHANDLED PROMISE REJECTION
err: {
"type": "TypeError",
"message": "Cannot read properties of undefined (reading 'status')",
"stack":
TypeError: Cannot read properties of undefined (reading 'status')
at /home/stefan/github/TruBudget/excel-export-service/dist/index.js:79:37
at processTicksAndRejections (node:internal/process/task_queues:96:5)
}
The first error is maybe correct, but it shouldn't be an unhandled promise rejection.