Skip to content

Commit

Permalink
Fix issue with enforced timeout (#397)
Browse files Browse the repository at this point in the history
fix(transport): fix issue with enforced timeout

Fix issue because of which timeout enforced by browser triggered wrong error status category.
  • Loading branch information
parfeon authored Aug 1, 2024
1 parent 44f9d6c commit ba45db4
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 14 deletions.
11 changes: 8 additions & 3 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
changelog:
- date: 2024-08-01
version: v8.2.7
changes:
- type: bug
text: "Fix issue because of which timeout enforced by browser triggered wrong error status category."
- date: 2024-07-23
version: v8.2.6
changes:
Expand Down Expand Up @@ -1018,7 +1023,7 @@ supported-platforms:
- 'Ubuntu 14.04 and up'
- 'Windows 7 and up'
version: 'Pubnub Javascript for Node'
version: '8.2.6'
version: '8.2.7'
sdks:
- full-name: PubNub Javascript SDK
short-name: Javascript
Expand All @@ -1034,7 +1039,7 @@ sdks:
- distribution-type: source
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.2.6.zip
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.2.7.zip
requires:
- name: 'agentkeepalive'
min-version: '3.5.2'
Expand Down Expand Up @@ -1705,7 +1710,7 @@ sdks:
- distribution-type: library
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/releases/download/v8.2.6/pubnub.8.2.6.js
location: https://github.com/pubnub/javascript/releases/download/v8.2.7/pubnub.8.2.7.js
requires:
- name: 'agentkeepalive'
min-version: '3.5.2'
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v8.2.7
August 01 2024

#### Fixed
- 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).

## v8.2.6
July 23 2024

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Watch [Getting Started with PubNub JS SDK](https://app.dashcam.io/replay/64ee0d2
npm install pubnub
```
* or download one of our builds from our CDN:
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.2.6.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.2.6.min.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.2.7.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.2.7.min.js
2. Configure your keys:
Expand Down
7 changes: 5 additions & 2 deletions dist/web/pubnub.js
Original file line number Diff line number Diff line change
Expand Up @@ -2839,7 +2839,10 @@
message = 'Network issues';
}
else if (errorName === 'TypeError') {
category = StatusCategory$1.PNBadRequestCategory;
if (message.indexOf('Load failed') !== -1 || message.indexOf('Failed to fetch') != -1)
category = StatusCategory$1.PNTimeoutCategory;
else
category = StatusCategory$1.PNBadRequestCategory;
}
else if (errorName === 'FetchError') {
const errorCode = error.code;
Expand Down Expand Up @@ -3813,7 +3816,7 @@
return base.PubNubFile;
},
get version() {
return '8.2.6';
return '8.2.7';
},
getVersion() {
return this.version;
Expand Down
4 changes: 2 additions & 2 deletions dist/web/pubnub.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/core/components/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const makeConfiguration = (base, setupCryptoModule) => {
return base.PubNubFile;
},
get version() {
return '8.2.6';
return '8.2.7';
},
getVersion() {
return this.version;
Expand Down
5 changes: 4 additions & 1 deletion lib/errors/pubnub-api-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ class PubNubAPIError extends Error {
message = 'Network issues';
}
else if (errorName === 'TypeError') {
category = categories_1.default.PNBadRequestCategory;
if (message.indexOf('Load failed') !== -1 || message.indexOf('Failed to fetch') != -1)
category = categories_1.default.PNTimeoutCategory;
else
category = categories_1.default.PNBadRequestCategory;
}
else if (errorName === 'FetchError') {
const errorCode = error.code;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pubnub",
"version": "8.2.6",
"version": "8.2.7",
"author": "PubNub <support@pubnub.com>",
"description": "Publish & Subscribe Real-time Messaging with PubNub",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/core/components/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const makeConfiguration = (
return base.PubNubFile;
},
get version(): string {
return '8.2.6';
return '8.2.7';
},
getVersion(): string {
return this.version;
Expand Down
4 changes: 3 additions & 1 deletion src/errors/pubnub-api-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ export class PubNubAPIError extends Error {
category = StatusCategory.PNNetworkIssuesCategory;
message = 'Network issues';
} else if (errorName === 'TypeError') {
category = StatusCategory.PNBadRequestCategory;
if (message.indexOf('Load failed') !== -1 || message.indexOf('Failed to fetch') != -1)
category = StatusCategory.PNTimeoutCategory;
else category = StatusCategory.PNBadRequestCategory;
} else if (errorName === 'FetchError') {
const errorCode = (error as Record<string, string>).code;

Expand Down

0 comments on commit ba45db4

Please sign in to comment.