Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
changelog:
- date: 2026-07-27
version: v12.0.3
changes:
- type: bug
text: "Fixes unbound fetch issue."
- date: 2026-07-22
version: v12.0.2
changes:
Expand Down Expand Up @@ -1437,7 +1442,7 @@ supported-platforms:
- 'Ubuntu 14.04 and up'
- 'Windows 7 and up'
version: 'Pubnub Javascript for Node'
version: '12.0.2'
version: '12.0.3'
sdks:
- full-name: PubNub Javascript SDK
short-name: Javascript
Expand All @@ -1453,7 +1458,7 @@ sdks:
- distribution-type: source
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/archive/refs/tags/v12.0.2.zip
location: https://github.com/pubnub/javascript/archive/refs/tags/v12.0.3.zip
requires:
- name: 'agentkeepalive'
min-version: '3.5.2'
Expand Down Expand Up @@ -2124,7 +2129,7 @@ sdks:
- distribution-type: library
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/releases/download/v12.0.2/pubnub.12.0.2.js
location: https://github.com/pubnub/javascript/releases/download/v12.0.3/pubnub.12.0.3.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 @@
## v12.0.3
July 27 2026

#### Fixed
- Fixes unbound fetch issue.

## v12.0.2
July 22 2026

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,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.12.0.2.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.12.0.2.min.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.12.0.3.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.12.0.3.min.js

> **React Native:** the SDK relies on a global `URL` implementation, which React Native does not
> provide, so it depends on [`react-native-url-polyfill`](https://www.npmjs.com/package/react-native-url-polyfill).
Expand Down
10 changes: 7 additions & 3 deletions dist/web/pubnub.js
Original file line number Diff line number Diff line change
Expand Up @@ -5477,7 +5477,7 @@
return base.PubNubFile;
},
get version() {
return '12.0.2';
return '12.0.3';
},
getVersion() {
return this.version;
Expand Down Expand Up @@ -6272,8 +6272,12 @@
// no `document`, and `fetch` cannot be reached through a fresh browsing context — return the context `fetch`
// directly. This is safe there: without a DOM there is no APM page script to monkey patch `fetch` in the
// first place. This environment check is what keeps the unconditional call in the constructor safe.
//
// `fetch` must be bound to the global scope: native `fetch` requires its `this` to be the `Window` /
// `WorkerGlobalScope`, and it is later invoked detached (`WebTransport.originalFetch(...)`). Without the bind
// a service worker throws "Failed to execute 'fetch' on 'WorkerGlobalScope': Illegal invocation".
if (typeof document === 'undefined' || !document.body)
return fetch;
return fetch.bind(globalThis);
let iframe = document.querySelector('iframe[name="pubnub-context-unpatched-fetch"]');
if (!iframe) {
iframe = document.createElement('iframe');
Expand All @@ -6284,7 +6288,7 @@
}
if (iframe.contentWindow)
return iframe.contentWindow.fetch.bind(iframe.contentWindow);
return fetch;
return fetch.bind(globalThis);
}
}
/**
Expand Down
2 changes: 1 addition & 1 deletion 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 @@ -174,7 +174,7 @@ const makeConfiguration = (base, setupCryptoModule) => {
return base.PubNubFile;
},
get version() {
return '12.0.2';
return '12.0.3';
},
getVersion() {
return this.version;
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": "12.0.2",
"version": "12.0.3",
"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 @@ -245,7 +245,7 @@ export const makeConfiguration = (
return base.PubNubFile;
},
get version(): string {
return '12.0.2';
return '12.0.3';
},
getVersion(): string {
return this.version;
Expand Down
8 changes: 6 additions & 2 deletions src/transport/web-transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,11 @@ export class WebTransport implements Transport {
// no `document`, and `fetch` cannot be reached through a fresh browsing context — return the context `fetch`
// directly. This is safe there: without a DOM there is no APM page script to monkey patch `fetch` in the
// first place. This environment check is what keeps the unconditional call in the constructor safe.
if (typeof document === 'undefined' || !document.body) return fetch;
//
// `fetch` must be bound to the global scope: native `fetch` requires its `this` to be the `Window` /
// `WorkerGlobalScope`, and it is later invoked detached (`WebTransport.originalFetch(...)`). Without the bind
// a service worker throws "Failed to execute 'fetch' on 'WorkerGlobalScope': Illegal invocation".
if (typeof document === 'undefined' || !document.body) return fetch.bind(globalThis);

let iframe = document.querySelector<HTMLIFrameElement>('iframe[name="pubnub-context-unpatched-fetch"]');

Expand All @@ -457,6 +461,6 @@ export class WebTransport implements Transport {
}

if (iframe.contentWindow) return iframe.contentWindow.fetch.bind(iframe.contentWindow);
return fetch;
return fetch.bind(globalThis);
}
}
Loading