From 6b4a7acb21d411c57d9b56825d09d9c5cad32e51 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Fri, 22 Sep 2023 11:53:10 +0200 Subject: [PATCH 1/2] check domain before access domain.context --- lib/myutils.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/myutils.js b/lib/myutils.js index 4ac07f3a..261c20b0 100644 --- a/lib/myutils.js +++ b/lib/myutils.js @@ -143,7 +143,7 @@ function requestHelperAux(method, options, withMetrics, callback) { } } options.headers = headers; - if (withMetrics && options.json && domain.context) { + if (withMetrics && options.json && domain && domain.context) { try { metrics.IncMetrics( domain.context.srv, @@ -157,7 +157,7 @@ function requestHelperAux(method, options, withMetrics, callback) { } request[method](options, function cbRequest2core(err, response, body) { var bodySz = 0; - if (withMetrics && domain.context) { + if (withMetrics && domain && domain.context) { if (body) { if (typeof body === 'string') { bodySz = Buffer.byteLength(body); @@ -178,7 +178,7 @@ function requestHelperAux(method, options, withMetrics, callback) { } if (err) { logErrorIf(err, util.format('error %s to %s', method, options.url)); - if (withMetrics && domain.context) { + if (withMetrics && domain && domain.context) { metrics.IncMetrics(domain.context.srv, domain.context.subsrv, metrics.outgoingTransactionsErrors); } return callback(err, null); @@ -196,7 +196,7 @@ function requestHelperAux(method, options, withMetrics, callback) { ); localError.httpCode = respObj.code < 500 && respObj.code >= 400 ? respObj.code : 500; logErrorIf(localError, null, domain && domain.context); - if (withMetrics && domain.context) { + if (withMetrics && domain && domain.context) { metrics.IncMetrics(domain.context.srv, domain.context.subsrv, metrics.outgoingTransactionsErrors); } return callback(localError, respObj); From 2a61f0ffda7a80fdbbb5d89436bd9d680472b41b Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Fri, 22 Sep 2023 12:40:25 +0200 Subject: [PATCH 2/2] Update CHANGES_NEXT_RELEASE --- CHANGES_NEXT_RELEASE | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 9b0a8cd6..32bf7527 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1,3 +1,4 @@ +- Fix: check domain before access domain - Fix: expandVar return a 'null' instead of null (#746) - Fix: smtp and smpp logs (#738) - Add: allow access entities using NGSIv2 API for non_signal rules (new setting nonSignalByAPI / PERSEO_CHECK_NON_SIGNAL_BY_API) (#549)