Skip to content

Commit 3da2c76

Browse files
authored
fix: handle incomplete localStorage in Node.js v25 (#2636)
1 parent 0133041 commit 3da2c76

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/core/utils/cookieStore.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ class CookieStore {
3636
}
3737

3838
private getCookieStoreIndex(): MemoryCookieStoreIndex {
39-
if (typeof localStorage === 'undefined') {
39+
if (
40+
typeof localStorage === 'undefined' ||
41+
typeof localStorage.getItem !== 'function'
42+
) {
4043
return {}
4144
}
4245

@@ -66,7 +69,10 @@ class CookieStore {
6669
}
6770

6871
private persist(): void {
69-
if (typeof localStorage === 'undefined') {
72+
if (
73+
typeof localStorage === 'undefined' ||
74+
typeof localStorage.setItem !== 'function'
75+
) {
7076
return
7177
}
7278

0 commit comments

Comments
 (0)