From 1322eb6a64074931f8bcdd2468719bcedfd4f20e Mon Sep 17 00:00:00 2001 From: turtledreams <62231246+turtledreams@users.noreply.github.com> Date: Tue, 9 Apr 2024 18:38:46 +0900 Subject: [PATCH 1/2] HC empty string issue --- CHANGELOG.md | 3 +++ cypress/integration/health_check.js | 2 +- lib/countly.js | 6 +++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 990b3648..9cd01126 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 23.12.7 +- Improved Health Check feature stability + ## 23.12.6 - Mitigated an issue where error tracking could prevent SDK initialization in async mode diff --git a/cypress/integration/health_check.js b/cypress/integration/health_check.js index 37246977..5c433e68 100644 --- a/cypress/integration/health_check.js +++ b/cypress/integration/health_check.js @@ -21,7 +21,7 @@ describe("Health Check tests ", () => { // Test the 'hc' parameter const hcParam = url.searchParams.get("hc"); const hcParamObj = JSON.parse(hcParam); - expect(hcParamObj).to.eql({ el: 0, wl: 0, sc: -1, em: "\"\"" }); + expect(hcParamObj).to.eql({ el: 0, wl: 0, sc: -1, em: "" }); // Test the 'metrics' parameter const metricsParam = url.searchParams.get("metrics"); diff --git a/lib/countly.js b/lib/countly.js index 4322376b..64f6af16 100644 --- a/lib/countly.js +++ b/lib/countly.js @@ -5334,12 +5334,16 @@ function sendInstantHCRequest() { // truncate error message to 1000 characters var curbedMessage = truncateSingleValue(self.hcErrorMessage, 1000, "healthCheck", log); + // due to some server issues we pass empty string as is + if (curbedMessage !== "") { + curbedMessage = JSON.stringify(curbedMessage); + } // prepare hc object var hc = { el: self.hcErrorCount, wl: self.hcWarningCount, sc: self.hcStatusCode, - em: JSON.stringify(curbedMessage) + em: curbedMessage }; // prepare request var request = { From 1be21d3df14b5bd3e91acee62a78dd1bedc4c597 Mon Sep 17 00:00:00 2001 From: turtledreams <62231246+turtledreams@users.noreply.github.com> Date: Tue, 23 Apr 2024 19:43:35 +0900 Subject: [PATCH 2/2] vversion update --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cd01126..c85e41e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 23.12.7 +# 24.4.0 - Improved Health Check feature stability ## 23.12.6