Skip to content

Commit 6bc5827

Browse files
authored
Merge c876d7e into 46596de
2 parents 46596de + c876d7e commit 6bc5827

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

.changeset/chilled-forks-accept.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/storage": patch
3+
---
4+
5+
Fixed issue where clients using Node.js v18 would use the native `Blob` object which is incompatible with `node-fetch`

packages/storage/src/implementation/type.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18+
import { isNode } from '@firebase/util';
1819
import { invalidArgument } from './error';
1920

2021
export function isJustDef<T>(p: T | null | undefined): p is T | null {
@@ -39,7 +40,9 @@ export function isNativeBlob(p: unknown): p is Blob {
3940
}
4041

4142
export function isNativeBlobDefined(): boolean {
42-
return typeof Blob !== 'undefined';
43+
// Note: The `isNode()` check can be removed when `node-fetch` adds native Blob support
44+
// PR: https://github.com/node-fetch/node-fetch/pull/1664
45+
return typeof Blob !== 'undefined' && !isNode();
4346
}
4447

4548
export function validateNumber(

packages/storage/test/unit/task.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ describe('Firebase Storage > Upload Task', () => {
505505

506506
// Function that notifies when we are in the middle of an exponential backoff
507507
const readyToCancel = new Promise<null>(resolve => {
508+
// @ts-ignore The types for `stub.callsFake` is incompatible with types of `clock.setTimeout`
508509
stub.callsFake((fn, timeout) => {
509510
// @ts-ignore The types for `stub.callsFake` is incompatible with types of `clock.setTimeout`
510511
const res = fakeSetTimeout(fn, timeout);

0 commit comments

Comments
 (0)