File tree 2 files changed +23
-0
lines changed
packages/auth/src/core/util
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @firebase/auth " : patch
3
+ ---
4
+
5
+ Fix FetchProvider in non-browser environments, by trying to get the ` fetch ` implementation from not only ` self ` but also standard ` globalThis ` .
Original file line number Diff line number Diff line change @@ -43,6 +43,12 @@ export class FetchProvider {
43
43
if ( typeof self !== 'undefined' && 'fetch' in self ) {
44
44
return self . fetch ;
45
45
}
46
+ if ( typeof globalThis !== 'undefined' && globalThis . fetch ) {
47
+ return globalThis . fetch ;
48
+ }
49
+ if ( typeof fetch !== 'undefined' ) {
50
+ return fetch ;
51
+ }
46
52
debugFail (
47
53
'Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'
48
54
) ;
@@ -55,6 +61,12 @@ export class FetchProvider {
55
61
if ( typeof self !== 'undefined' && 'Headers' in self ) {
56
62
return self . Headers ;
57
63
}
64
+ if ( typeof globalThis !== 'undefined' && globalThis . Headers ) {
65
+ return globalThis . Headers ;
66
+ }
67
+ if ( typeof Headers !== 'undefined' ) {
68
+ return Headers ;
69
+ }
58
70
debugFail (
59
71
'Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'
60
72
) ;
@@ -67,6 +79,12 @@ export class FetchProvider {
67
79
if ( typeof self !== 'undefined' && 'Response' in self ) {
68
80
return self . Response ;
69
81
}
82
+ if ( typeof globalThis !== 'undefined' && globalThis . Response ) {
83
+ return globalThis . Response ;
84
+ }
85
+ if ( typeof Response !== 'undefined' ) {
86
+ return Response ;
87
+ }
70
88
debugFail (
71
89
'Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill'
72
90
) ;
You can’t perform that action at this time.
0 commit comments