@naturalcycles/backend-lib 4.17.3 → 4.17.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deploy/deployHealthCheck.js +2 -2
- package/dist/server/catchWrapper.js +0 -1
- package/dist/server/genericErrorMiddleware.js +3 -0
- package/package.json +1 -1
- package/src/deploy/deployHealthCheck.ts +2 -2
- package/src/server/catchWrapper.ts +0 -1
- package/src/server/genericErrorMiddleware.ts +3 -0
|
@@ -67,7 +67,6 @@ async function deployHealthCheck(url, opt = {}) {
|
|
|
67
67
|
let currentInterval = intervalSec * 1000;
|
|
68
68
|
const fetcher = (0, js_lib_1.getFetcher)();
|
|
69
69
|
while (!done) {
|
|
70
|
-
// eslint-disable-next-line no-await-in-loop
|
|
71
70
|
await makeAttempt();
|
|
72
71
|
}
|
|
73
72
|
if (failed) {
|
|
@@ -84,7 +83,8 @@ async function deployHealthCheck(url, opt = {}) {
|
|
|
84
83
|
attempt++;
|
|
85
84
|
console.log([`>>`, (0, colors_1.dimGrey)(url), (0, node_util_1.inspect)({ attempt }, inspectOpt)].join(' '));
|
|
86
85
|
const started = Date.now();
|
|
87
|
-
const { err, fetchResponse } = await fetcher.doFetch(
|
|
86
|
+
const { err, fetchResponse } = await fetcher.doFetch({
|
|
87
|
+
url,
|
|
88
88
|
mode: 'json',
|
|
89
89
|
timeoutSeconds: timeoutSec,
|
|
90
90
|
retry: {
|
|
@@ -53,6 +53,9 @@ function respondWithError(req, res, err) {
|
|
|
53
53
|
delete httpError.stack;
|
|
54
54
|
httpError.data.errorId = errorId;
|
|
55
55
|
httpError.data.backendResponseStatusCode ||= 500; // default to 500
|
|
56
|
+
// httpStatusCode is for backwards-compatibility
|
|
57
|
+
// Otherwise, it breaks the _isHttpErrorResponse function check, and error get formatted/detected wrongly
|
|
58
|
+
httpError.data['httpStatusCode'] = httpError.data.backendResponseStatusCode;
|
|
56
59
|
httpError.data.headersSent = headersSent || undefined;
|
|
57
60
|
httpError.data.report ||= undefined; // set to undefined if false
|
|
58
61
|
(0, js_lib_1._filterUndefinedValues)(httpError.data, true);
|
package/package.json
CHANGED
|
@@ -97,7 +97,6 @@ export async function deployHealthCheck(
|
|
|
97
97
|
const fetcher = getFetcher()
|
|
98
98
|
|
|
99
99
|
while (!done) {
|
|
100
|
-
// eslint-disable-next-line no-await-in-loop
|
|
101
100
|
await makeAttempt()
|
|
102
101
|
}
|
|
103
102
|
|
|
@@ -126,7 +125,8 @@ export async function deployHealthCheck(
|
|
|
126
125
|
|
|
127
126
|
const started = Date.now()
|
|
128
127
|
|
|
129
|
-
const { err, fetchResponse } = await fetcher.doFetch(
|
|
128
|
+
const { err, fetchResponse } = await fetcher.doFetch({
|
|
129
|
+
url,
|
|
130
130
|
mode: 'json',
|
|
131
131
|
timeoutSeconds: timeoutSec,
|
|
132
132
|
retry: {
|
|
@@ -86,6 +86,9 @@ export function respondWithError(req: BackendRequest, res: BackendResponse, err:
|
|
|
86
86
|
|
|
87
87
|
httpError.data.errorId = errorId
|
|
88
88
|
httpError.data.backendResponseStatusCode ||= 500 // default to 500
|
|
89
|
+
// httpStatusCode is for backwards-compatibility
|
|
90
|
+
// Otherwise, it breaks the _isHttpErrorResponse function check, and error get formatted/detected wrongly
|
|
91
|
+
httpError.data['httpStatusCode'] = httpError.data.backendResponseStatusCode
|
|
89
92
|
httpError.data.headersSent = headersSent || undefined
|
|
90
93
|
httpError.data.report ||= undefined // set to undefined if false
|
|
91
94
|
_filterUndefinedValues(httpError.data, true)
|