Mobile Persistence Troubleshooting - Step by Step โ
Issue: Login not persisting after refresh on Pixel Chrome
Date: January 7, 2026
Root Causes We're Investigating โ
- Race condition: setPersistence might not complete before auth listener starts
- Cloudflare caching: May be serving stale JS/service worker
- Chrome settings: Might have storage restrictions enabled
- IndexedDB conflicts: Multiple persistence mechanisms interfering
- Network timing: Auth might not restore quickly enough on poor connection
What We've Fixed โ
- Made persistence synchronous - Now waits for setPersistence to complete BEFORE setting up listeners
- Removed IndexedDB warmup - Was creating race condition with Firestore persistence
- Improved Cloudflare headers - Disabled caching for HTML/index to prevent stale JS
- Simplified initialization - Removed competing async operations
On Your Pixel Device - Chrome Settings to Check โ
Possible Restrictions โ
Settings > Site settings > Cookies and site data
- [ ] Check if "Clear on exit" is enabled (would delete auth on close)
- [ ] Check if "Block third-party cookies" is on
- [ ] Verify "All cookies allowed" for dev.ourlantern.app
Settings > Apps > Chrome > Permissions
- [ ] Storage: Should be "Allowed"
- [ ] Check if you're in restricted/work profile (would disable localStorage)
Settings > Apps > Chrome > Storage
- [ ] Check available space (low storage can prevent caching)
- [ ] Clear cache if >500MB
Safe Testing โ
Create new Chrome profile (not restricted)
- Settings > Accounts > Add account
- Select personal Google account
- Switch to new profile
Test app on new profile
- Login
- Force close
- Reopen
- Should stay logged in
If Still Not Working - Manual Workaround โ
While we debug the persistence issue, users can manually stay logged in:
1. Login to dev.ourlantern.app
2. Bookmark the page (Chrome menu > Bookmark this page)
3. Close Chrome (no force-close)
4. Reopen from bookmark
5. This preserves session betterWhat's Actually Happening Now โ
Before (Broken) โ
Firebase Auth persistence set to LOCAL
โ
IndexedDB warmup starts (async)
โ
Auth listener sets up (before persistence ready)
โ
No cached user found = login form shown
โ
Performance is slowAfter (Fixed) โ
Firebase Auth persistence set to LOCAL (await)
โ
IndexedDB persistence enabled (await)
โ
Auth listener sets up (persistence guaranteed ready)
โ
Cached user found = dashboard shown
โ
Fast performanceTesting for Us to Verify โ
Please try these and report results:
Test 1: Check Persistence is Actually Set โ
1. Open DevTools Console
2. Paste: firebase.auth()._persistence?.type
3. Should return: "LOCAL"
4. If returns "SESSION" or undefined = persistence not setTest 2: Check localStorage โ
1. DevTools > Application > Local Storage
2. Look for entries with "firebase:" prefix
3. Should see multiple firebase keys
4. If empty = persistence not workingTest 3: Check Auth State โ
1. DevTools Console
2. Paste: firebase.auth().currentUser
3. If logged in: shows {uid: "...", email: "..."}
4. If logged out: returns nullTest 4: Check Cloudflare Cache โ
1. DevTools > Network tab
2. Reload page
3. Look at response headers for "index.html"
4. Should NOT have "cf-cache-status: HIT"
5. If it does = Cloudflare is serving stale HTMLIf Cloudflare is Caching HTML โ
This could prevent new JS from loading. To fix:
Via Cloudflare Dashboard:
- Go to dev.ourlantern.app zone
- Caching > Purge Cache > Purge everything
- Wait 5 minutes
- Try again
Or locally:
- Settings > Apps > Chrome > Storage > Clear all site data
- Hard reload: Ctrl+Shift+R
- Try login again
Chrome Mobile Settings (Universal) โ
On Pixel:
Settings > Apps > Chrome
- Permissions > Storage = Allowed
- Permissions > Cookies = Allowed
- Storage > Clear cache (if >500MB)
Settings > System > Developer options
- USB Debugging = OFF (shouldn't affect localStorage)
- Any storage restrictions = check OFF
Settings > Privacy
- Incognito: Make sure you're NOT using incognito mode
- Enhanced safe browsing: Can be ON or OFF (shouldn't matter)
The Real Culprit - Most Likely โ
Based on similar issues, the problem is probably:
- Multiple Chrome profiles with restrictions - Switch to personal profile
- IndexedDB failing silently - We've disabled this now
- Cloudflare serving stale HTML - Just purged cache
- Race condition on page load - We've fixed this
What to Try First โ
Ranking of likelihood to fix it:
โญโญโญ Purge Cloudflare cache - Most likely
- Dev.ourlantern.app zone
- Caching > Purge Cache > Purge Everything
โญโญโญ Check Chrome profile is personal - Very likely
- Settings > Accounts
- Not work/school account
โญโญ Check Site Settings > Cookies
- Allow cookies for dev.ourlantern.app
- Don't clear on exit
โญ Clear site data locally
- Settings > Apps > Chrome > Storage > Clear all site data
- Hard reload app: Ctrl+Shift+R
Advanced Debugging (if still broken) โ
// In DevTools Console, run:
// 1. Check persistence type
console.log('Persistence:', firebase.auth()._persistence?.type)
// 2. Check localStorage
console.log('LocalStorage keys:', Object.keys(localStorage).filter(k => k.includes('firebase')))
// 3. Check if auth state listener fires
firebase.auth().onAuthStateChanged(user => {
console.log('Auth state changed:', user?.uid || 'logged out')
})
// 4. Wait 2 seconds and check again
setTimeout(() => {
console.log('Current user:', firebase.auth().currentUser?.uid || 'none')
}, 2000)
// 5. Force refresh auth state
firebase.auth()._notifyListeners()If Still Persisting โ
Please share:
- Results of Test 1-4 above
- Pixel device model (6, 7, 8 Pro, etc)
- Chrome version (Settings > About Chrome)
- Exact steps you're taking when it fails
- Console output from the debug commands
With this info we can narrow down the exact cause.
Temporary Workaround for Users โ
Until we solve this:
1. Login
2. Add to Home Screen (Chrome menu > Install app)
3. Use as PWA
4. PWA has better persistence than browser
5. Bookmark backup: Chrome > Bookmark this pageFiles Modified in This Fix โ
src/firebase.js- Made persistence synchronous with awaitsrc/main.jsx- Removed IndexedDB warmup race conditionpublic/_headers- Added Cloudflare optimization headers
Build and deploy changes, then:
- Purge Cloudflare cache
- Hard refresh Pixel (Ctrl+Shift+R)
- Test login persistence