From 318f1a79d0aa3a6af801268df5444ecec33fe100 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Fri, 9 Jul 2021 13:37:59 +0200 Subject: [PATCH 1/5] remove cbnotif from correlator --- lib/routes/actionsController.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/routes/actionsController.js b/lib/routes/actionsController.js index b6751c34..23eeddf5 100644 --- a/lib/routes/actionsController.js +++ b/lib/routes/actionsController.js @@ -44,6 +44,8 @@ function PostAction(req, resp) { now = Date.now(), MAX_AGE_CORR = 15 * 60 * 1000; + // remove cbnotif from correlator + correlator = correlator.replace(/ cbnotif=\d;-/g,''); firedEvent = req.body || {}; firedEvent.subservice = req.subservice; firedEvent.service = req.service; From fd1a4470c0ebdf357c22d32dcd177dea1b6c8648 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Fri, 9 Jul 2021 13:39:13 +0200 Subject: [PATCH 2/5] update CNR --- CHANGES_NEXT_RELEASE | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 90db27ff..0d0be553 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1,3 +1,4 @@ +Update: remove cbnotif from correlator (#536) Fix: ngsiv2 initial notification does not include a list of subservices in servicePath header when is / (#527) Update mongodb dep driver from 3.6.3 to 3.6.8 -Update nodemailer dep from 6.4.8 to 6.4.18 \ No newline at end of file +Update nodemailer dep from 6.4.8 to 6.4.18 From 515606fd29bb02b645a2d9bfc71dad98d3c2ed04 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Fri, 9 Jul 2021 14:04:02 +0200 Subject: [PATCH 3/5] fix --- lib/routes/actionsController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/routes/actionsController.js b/lib/routes/actionsController.js index 23eeddf5..38cd5180 100644 --- a/lib/routes/actionsController.js +++ b/lib/routes/actionsController.js @@ -45,7 +45,7 @@ function PostAction(req, resp) { MAX_AGE_CORR = 15 * 60 * 1000; // remove cbnotif from correlator - correlator = correlator.replace(/ cbnotif=\d;-/g,''); + correlator = correlator.replace(/ cbnotif=\d;/g,''); firedEvent = req.body || {}; firedEvent.subservice = req.subservice; firedEvent.service = req.service; From de03a7cc9f1e13cbe07fcc6e36da8f15dafd020f Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Mon, 12 Jul 2021 09:10:54 +0200 Subject: [PATCH 4/5] Update CHANGES_NEXT_RELEASE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fermín Galán Márquez --- CHANGES_NEXT_RELEASE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 086af2aa..65d52b88 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1,4 +1,4 @@ -Update: remove cbnotif from correlator (#536) +Fix: remove cbnotif from correlator (#536) Update ngsijs dep from 1.2.1 to 1.3.0 Fix: ngsiv2 initial notification does not include a list of subservices in servicePath header when is / (#527) Update mongodb dep driver from 3.6.3 to 3.6.8 From e0b10f767727e856dda1924624bb125e3f0fbd01 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Mon, 12 Jul 2021 10:41:43 +0200 Subject: [PATCH 5/5] check before replace --- lib/constants.js | 3 ++- lib/routes/actionsController.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/constants.js b/lib/constants.js index fad425d9..54761d46 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -33,5 +33,6 @@ module.exports = { AUTH_HEADER: 'X-Auth-Token', REALIP_HEADER: 'X-Real-IP', TOTAL_COUNT_HEADER: 'fiware-total-count', - COMPONENT_NAME: 'perseo-fe' + COMPONENT_NAME: 'perseo-fe', + CB_NOTIF_REGEX: / cbnotif=\d;/g }; diff --git a/lib/routes/actionsController.js b/lib/routes/actionsController.js index 38cd5180..f823c032 100644 --- a/lib/routes/actionsController.js +++ b/lib/routes/actionsController.js @@ -44,8 +44,6 @@ function PostAction(req, resp) { now = Date.now(), MAX_AGE_CORR = 15 * 60 * 1000; - // remove cbnotif from correlator - correlator = correlator.replace(/ cbnotif=\d;/g,''); firedEvent = req.body || {}; firedEvent.subservice = req.subservice; firedEvent.service = req.service; @@ -53,6 +51,8 @@ function PostAction(req, resp) { metrics.IncMetrics(req.service, req.subservice, metrics.firedRules); if (correlator) { + // remove " cbnotif=X;" from correlator + correlator = correlator.replace(constants.CB_NOTIF_REGEX, ''); // try detect loop corrAge[correlator] = now; rulesWithCorr = recentAxn[correlator];