Skip to content

Commit

Permalink
HC empty string issue
Browse files Browse the repository at this point in the history
  • Loading branch information
turtledreams committed Apr 9, 2024
1 parent 53998e5 commit 1322eb6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/health_check.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
6 changes: 5 additions & 1 deletion lib/countly.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 1322eb6

Please sign in to comment.