Skip to content

Commit

Permalink
chore(release): pulling release/2.0.2 into master
Browse files Browse the repository at this point in the history
chore(release): pulling release/2.0.2 into master
  • Loading branch information
MoumitaM authored Feb 16, 2023
2 parents 14d28d0 + 7fa4d60 commit ef4ce04
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 29 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: "BUG : <Title>"
labels: bug, open source
assignees: MoumitaM
---

**Describe the bug**
Please provide the following information:

1. A clear and concise description of what the bug is
2. Share the event payload
3. Offer a minimal viable example to reproduce the issue
4. Include the error's stack trace
5. Mention the date when the issue began

**To Reproduce**
Steps to reproduce the behaviour:

1. Initialise Node SDK
2. Make events '....'
3. See the error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Version of the _Node_ SDK**
Please mention the version of the Rudder Node SDK you are using (e.g., Node SDK v1.0.0).

**SDK initialisation snippet**
Share the code snippet used for initializing the Node SDK.

**Check for Correct Usage of _writeKey_ and _dataPlaneUrl_**
Confirm that the correct `writeKey` and `dataPlaneUrl` are utilized during SDK initialization.
7 changes: 7 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

## [v2.0.2](https://github.com/rudderlabs/rudder-sdk-node/compare/v2.0.1...v2.0.2)

### Fixes

- flush after a single event is sent [`#93`](https://github.com/rudderlabs/rudder-sdk-node/pull/93)
- added more loggers to assist debugging [`#94`](https://github.com/rudderlabs/rudder-sdk-node/pull/94)

## [v2.0.1](https://github.com/rudderlabs/rudder-sdk-node/compare/v2.0.0...v2.0.1)

### Fixes
Expand Down
32 changes: 29 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class Analytics {
retryDelay: axiosRetry.exponentialDelay,
...options.axiosRetryConfig,
// retryCondition is below optional config to ensure it does not get overridden
retryCondition: this._isErrorRetryable,
retryCondition: this._isErrorRetryable.bind(this),
});
}
}
Expand Down Expand Up @@ -172,9 +172,14 @@ class Analytics {
})
.catch((err) => {
// check if request is retryable
if (_isErrorRetryable(err)) {
const isRetryable = _isErrorRetryable(err);
this.logger.debug(
`Request is ${isRetryable ? "" : "not"} to be retried`
);
if (isRetryable) {
const attempts = jobData.attempts;
jobData.attempts = attempts + 1;
this.logger.debug(`Request retry attempt ${attempts}`);
// increment attempt
// add a new job to queue in lifo
// if able to add, mark the earlier job done with push to completed with a msg
Expand Down Expand Up @@ -601,6 +606,17 @@ class Analytics {
}

if (!this.queue.length) {
if (this.pendingFlush) {
this.logger.debug('queue is empty, but a flush already exists');
// We attach the callback to the end of the chain to support a caller calling `flush()` multiple times when the queue is empty.
this.pendingFlush = this.pendingFlush
.then(() => {
callback();
return Promise.resolve();
});
return this.pendingFlush;
}

this.logger.debug('queue is empty, nothing to flush');
setImmediate(callback);
return Promise.resolve();
Expand Down Expand Up @@ -701,6 +717,9 @@ class Analytics {
return Promise.resolve(data);
})
.catch((err) => {
this.logger.error(
`Error: ${err.response ? err.response.statusText : err.code}`
);
const isDuringTestExecution =
err &&
err.response &&
Expand Down Expand Up @@ -736,6 +755,14 @@ class Analytics {
}

_isErrorRetryable(error) {
if(error.response) {
this.logger.error(
"Response error status: " + error.response.status + "\nResponse error code: " + error.code
);
} else {
this.logger.error("Response error code: " + error.code);
}

// Retry Network Errors.
if (axiosRetry.isNetworkError(error)) {
return true;
Expand All @@ -746,7 +773,6 @@ class Analytics {
return false;
}

// this.logger.error("error status: " + error.response.status);
// Retry Server Errors (5xx).
if (error.response.status >= 500 && error.response.status <= 599) {
return true;
Expand Down
34 changes: 11 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rudderstack/rudder-sdk-node",
"version": "2.0.1",
"version": "2.0.2",
"description": "Rudder Node SDK",
"license": "",
"repository": "rudderlabs/rudder-sdk-node",
Expand Down Expand Up @@ -114,7 +114,8 @@
"dot-prop": "5.3.0",
"semver": "7.3.8",
"semver-regex": "3.1.4",
"json5": "2.2.2"
"json5": "2.2.2",
"http-cache-semantics": "4.1.1"
},
"resolutions": {
"kind-of": "^6.0.3",
Expand All @@ -128,7 +129,8 @@
"dot-prop": "5.3.0",
"semver": "7.3.8",
"semver-regex": "3.1.4",
"json5": "2.2.2"
"json5": "2.2.2",
"http-cache-semantics": "4.1.1"
},
"optionalDependencies": {
"bull": "^4.10.2"
Expand Down

0 comments on commit ef4ce04

Please sign in to comment.