Skip to content

Commit 32cc0bd

Browse files
mohitpubnubMohit Tejaniparfeonpubnub-release-bot
authored
Fix/prevent retry for non retryable 404 status code (#488)
* exclude 404 from retryable * update branch * refactor(error): add error description for HTTP 404 status code * test: appcontext response with 404 * fix lint issue * text enhancement to check retry would not take place, add dist/lib updated * refactor: test, to verify retry not happening on 404 * PubNub SDK v10.2.6 release. --------- Co-authored-by: Mohit Tejani <mohit.tejani@Mohits-MacBook-Pro.local> Co-authored-by: Serhii Mamontov <parfeon@me.com> Co-authored-by: PubNub Release Bot <120067856+pubnub-release-bot@users.noreply.github.com>
1 parent e8362c3 commit 32cc0bd

15 files changed

Lines changed: 151 additions & 16 deletions

File tree

.pubnub.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
---
22
changelog:
3+
- date: 2026-01-13
4+
version: v10.2.6
5+
changes:
6+
- type: improvement
7+
text: "Prevent retry when response is having http status code 404."
38
- date: 2025-12-16
49
version: v10.2.5
510
changes:
@@ -1379,7 +1384,7 @@ supported-platforms:
13791384
- 'Ubuntu 14.04 and up'
13801385
- 'Windows 7 and up'
13811386
version: 'Pubnub Javascript for Node'
1382-
version: '10.2.5'
1387+
version: '10.2.6'
13831388
sdks:
13841389
- full-name: PubNub Javascript SDK
13851390
short-name: Javascript
@@ -1395,7 +1400,7 @@ sdks:
13951400
- distribution-type: source
13961401
distribution-repository: GitHub release
13971402
package-name: pubnub.js
1398-
location: https://github.com/pubnub/javascript/archive/refs/tags/v10.2.5.zip
1403+
location: https://github.com/pubnub/javascript/archive/refs/tags/v10.2.6.zip
13991404
requires:
14001405
- name: 'agentkeepalive'
14011406
min-version: '3.5.2'
@@ -2066,7 +2071,7 @@ sdks:
20662071
- distribution-type: library
20672072
distribution-repository: GitHub release
20682073
package-name: pubnub.js
2069-
location: https://github.com/pubnub/javascript/releases/download/v10.2.5/pubnub.10.2.5.js
2074+
location: https://github.com/pubnub/javascript/releases/download/v10.2.6/pubnub.10.2.6.js
20702075
requires:
20712076
- name: 'agentkeepalive'
20722077
min-version: '3.5.2'

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## v10.2.6
2+
January 13 2026
3+
4+
#### Modified
5+
- Prevent retry when response is having http status code 404.
6+
17
## v10.2.5
28
December 16 2025
39

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ Watch [Getting Started with PubNub JS SDK](https://app.dashcam.io/replay/64ee0d2
2727
npm install pubnub
2828
```
2929
* or download one of our builds from our CDN:
30-
* https://cdn.pubnub.com/sdk/javascript/pubnub.10.2.5.js
31-
* https://cdn.pubnub.com/sdk/javascript/pubnub.10.2.5.min.js
30+
* https://cdn.pubnub.com/sdk/javascript/pubnub.10.2.6.js
31+
* https://cdn.pubnub.com/sdk/javascript/pubnub.10.2.6.min.js
3232
3333
2. Configure your keys:
3434

dist/web/pubnub.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3118,6 +3118,8 @@
31183118
data !== null && data !== void 0 ? data : (data = response.body);
31193119
if (status === 402)
31203120
message = 'Not available for used key set. Contact support@pubnub.com';
3121+
else if (status === 404)
3122+
message = 'Resource not found';
31213123
else if (status === 400) {
31223124
category = StatusCategory$1.PNBadRequestCategory;
31233125
message = 'Bad request';
@@ -5436,7 +5438,7 @@
54365438
return base.PubNubFile;
54375439
},
54385440
get version() {
5439-
return '10.2.5';
5441+
return '10.2.6';
54405442
},
54415443
getVersion() {
54425444
return this.version;
@@ -5790,7 +5792,7 @@
57905792
activeCancellation = attemptCancellation;
57915793
const responseHandler = (res, error) => {
57925794
const retriableError = error ? error.category !== StatusCategory$1.PNCancelledCategory : true;
5793-
const retriableStatusCode = !res || res.status >= 400;
5795+
const retriableStatusCode = (!res || res.status >= 400) && (error === null || error === void 0 ? void 0 : error.statusCode) !== 404;
57945796
let delay = -1;
57955797
if (retriableError &&
57965798
retriableStatusCode &&

dist/web/pubnub.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/core/components/configuration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ const makeConfiguration = (base, setupCryptoModule) => {
168168
return base.PubNubFile;
169169
},
170170
get version() {
171-
return '10.2.5';
171+
return '10.2.6';
172172
},
173173
getVersion() {
174174
return this.version;

lib/errors/pubnub-api-error.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ class PubNubAPIError extends Error {
125125
data !== null && data !== void 0 ? data : (data = response.body);
126126
if (status === 402)
127127
message = 'Not available for used key set. Contact support@pubnub.com';
128+
else if (status === 404)
129+
message = 'Resource not found';
128130
else if (status === 400) {
129131
category = categories_1.default.PNBadRequestCategory;
130132
message = 'Bad request';

lib/transport/middleware.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class PubNubMiddleware {
125125
activeCancellation = attemptCancellation;
126126
const responseHandler = (res, error) => {
127127
const retriableError = error ? error.category !== categories_1.default.PNCancelledCategory : true;
128-
const retriableStatusCode = !res || res.status >= 400;
128+
const retriableStatusCode = (!res || res.status >= 400) && (error === null || error === void 0 ? void 0 : error.statusCode) !== 404;
129129
let delay = -1;
130130
if (retriableError &&
131131
retriableStatusCode &&

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pubnub",
3-
"version": "10.2.5",
3+
"version": "10.2.6",
44
"author": "PubNub <support@pubnub.com>",
55
"description": "Publish & Subscribe Real-time Messaging with PubNub",
66
"scripts": {

0 commit comments

Comments
 (0)