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
5 changes: 5 additions & 0 deletions .changeset/chilled-forks-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/storage": patch
---

Fixed issue where clients using Node.js v18 would use the native `Blob` object which is incompatible with `node-fetch`
5 changes: 4 additions & 1 deletion packages/storage/src/implementation/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/

import { isNode } from '@firebase/util';
import { invalidArgument } from './error';

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

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

export function validateNumber(
Expand Down
1 change: 1 addition & 0 deletions packages/storage/test/unit/task.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ describe('Firebase Storage > Upload Task', () => {

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