Skip to content

Commit ba45db4

Browse files
authored
Fix issue with enforced timeout (#397)
fix(transport): fix issue with enforced timeout Fix issue because of which timeout enforced by browser triggered wrong error status category.
1 parent 44f9d6c commit ba45db4

File tree

10 files changed

+33
-14
lines changed

10 files changed

+33
-14
lines changed

.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: 2024-08-01
4+
version: v8.2.7
5+
changes:
6+
- type: bug
7+
text: "Fix issue because of which timeout enforced by browser triggered wrong error status category."
38
- date: 2024-07-23
49
version: v8.2.6
510
changes:
@@ -1018,7 +1023,7 @@ supported-platforms:
10181023
- 'Ubuntu 14.04 and up'
10191024
- 'Windows 7 and up'
10201025
version: 'Pubnub Javascript for Node'
1021-
version: '8.2.6'
1026+
version: '8.2.7'
10221027
sdks:
10231028
- full-name: PubNub Javascript SDK
10241029
short-name: Javascript
@@ -1034,7 +1039,7 @@ sdks:
10341039
- distribution-type: source
10351040
distribution-repository: GitHub release
10361041
package-name: pubnub.js
1037-
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.2.6.zip
1042+
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.2.7.zip
10381043
requires:
10391044
- name: 'agentkeepalive'
10401045
min-version: '3.5.2'
@@ -1705,7 +1710,7 @@ sdks:
17051710
- distribution-type: library
17061711
distribution-repository: GitHub release
17071712
package-name: pubnub.js
1708-
location: https://github.com/pubnub/javascript/releases/download/v8.2.6/pubnub.8.2.6.js
1713+
location: https://github.com/pubnub/javascript/releases/download/v8.2.7/pubnub.8.2.7.js
17091714
requires:
17101715
- name: 'agentkeepalive'
17111716
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+
## v8.2.7
2+
August 01 2024
3+
4+
#### Fixed
5+
- Fix issue because of which timeout enforced by browser triggered wrong error status category. Fixed the following issues reported by [@WalrusSoup](https://github.com/WalrusSoup): [#396](https://github.com/pubnub/javascript/issues/396).
6+
17
## v8.2.6
28
July 23 2024
39

README.md

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

dist/web/pubnub.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2839,7 +2839,10 @@
28392839
message = 'Network issues';
28402840
}
28412841
else if (errorName === 'TypeError') {
2842-
category = StatusCategory$1.PNBadRequestCategory;
2842+
if (message.indexOf('Load failed') !== -1 || message.indexOf('Failed to fetch') != -1)
2843+
category = StatusCategory$1.PNTimeoutCategory;
2844+
else
2845+
category = StatusCategory$1.PNBadRequestCategory;
28432846
}
28442847
else if (errorName === 'FetchError') {
28452848
const errorCode = error.code;
@@ -3813,7 +3816,7 @@
38133816
return base.PubNubFile;
38143817
},
38153818
get version() {
3816-
return '8.2.6';
3819+
return '8.2.7';
38173820
},
38183821
getVersion() {
38193822
return this.version;

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
@@ -110,7 +110,7 @@ const makeConfiguration = (base, setupCryptoModule) => {
110110
return base.PubNubFile;
111111
},
112112
get version() {
113-
return '8.2.6';
113+
return '8.2.7';
114114
},
115115
getVersion() {
116116
return this.version;

lib/errors/pubnub-api-error.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ class PubNubAPIError extends Error {
6262
message = 'Network issues';
6363
}
6464
else if (errorName === 'TypeError') {
65-
category = categories_1.default.PNBadRequestCategory;
65+
if (message.indexOf('Load failed') !== -1 || message.indexOf('Failed to fetch') != -1)
66+
category = categories_1.default.PNTimeoutCategory;
67+
else
68+
category = categories_1.default.PNBadRequestCategory;
6669
}
6770
else if (errorName === 'FetchError') {
6871
const errorCode = error.code;

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": "8.2.6",
3+
"version": "8.2.7",
44
"author": "PubNub <[email protected]>",
55
"description": "Publish & Subscribe Real-time Messaging with PubNub",
66
"scripts": {

src/core/components/configuration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export const makeConfiguration = (
169169
return base.PubNubFile;
170170
},
171171
get version(): string {
172-
return '8.2.6';
172+
return '8.2.7';
173173
},
174174
getVersion(): string {
175175
return this.version;

src/errors/pubnub-api-error.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ export class PubNubAPIError extends Error {
5858
category = StatusCategory.PNNetworkIssuesCategory;
5959
message = 'Network issues';
6060
} else if (errorName === 'TypeError') {
61-
category = StatusCategory.PNBadRequestCategory;
61+
if (message.indexOf('Load failed') !== -1 || message.indexOf('Failed to fetch') != -1)
62+
category = StatusCategory.PNTimeoutCategory;
63+
else category = StatusCategory.PNBadRequestCategory;
6264
} else if (errorName === 'FetchError') {
6365
const errorCode = (error as Record<string, string>).code;
6466

0 commit comments

Comments
 (0)