diff --git a/CHANGELOG.md b/CHANGELOG.md index d00506b..13381ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 23.12.6 * Mitigated an issue where error tracking could prevent SDK initialization in async mode +* Improved Health Check reporting ## 23.12.5 diff --git a/cypress/e2e/health_check.cy.js b/cypress/e2e/health_check.cy.js index 131bb7d..0d2fc4e 100644 --- a/cypress/e2e/health_check.cy.js +++ b/cypress/e2e/health_check.cy.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/modules/CountlyClass.js b/modules/CountlyClass.js index 15de017..42dd91d 100644 --- a/modules/CountlyClass.js +++ b/modules/CountlyClass.js @@ -4754,12 +4754,16 @@ class CountlyClass { 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 = {