Skip to content

iOS 18.3.2+ Cloud Firestore could not connect to backend. #14712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
khaelou opened this issue Apr 14, 2025 · 5 comments
Closed

iOS 18.3.2+ Cloud Firestore could not connect to backend. #14712

khaelou opened this issue Apr 14, 2025 · 5 comments

Comments

@khaelou
Copy link

khaelou commented Apr 14, 2025

Description

Recently when testing our app for iPad Air (5th generation) on iOS 18.4 or iOS 18.3.2+ an issue connecting to Cloud Firestore has caused our app to not pass Apple's review stage.

I should mention, the simulator is indeed connected to Internet as I've double check many times with Safari when testing.

Initially I thought it was the Firestore configuration, it's odd for me because if I freshly install the app on the simulator device it works fine, yet say I close the app after a fresh install, or just use it normally then this error arises and causes Firestore to not connect.

For context the following is a reference to the issue at firebase-js-sdk and a reproduction repo for testing:

firebase-js-sdk Issue #8889

khaelou/bare

Reproducing the issue

No response

Firebase SDK Version

11.6.0

Xcode Version

16.3

Installation Method

N/A

Firebase Product(s)

Firestore

Targeted Platforms

iOS

Relevant Log Output

Task <79785CB1-C759-4039-B541-E6D9EA56A907>.<9> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=-4, NSUnderlyingError=0x600000cc1860 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x600002173cf0 [0x7ff840033d10]>{length = 16, capacity = 16, bytes = 0x100201bb8efa450a0000000000000000}, _kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <79785CB1-C759-4039-B541-E6D9EA56A907>.<9>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <79785CB1-C759-4039-B541-E6D9EA56A907>.<9>"
), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://firestore.googleapis.com/google.firestore.v1.Firestore/Listen/channel?VER=8&database=projects%2Fbare-ai%2Fdatabases%2F(default)&RID=28518&CVER=22&X-HTTP-Session-Id=gsessionid&zx=lpcnuoa6aknn&t=1, NSErrorFailingURLKey=https://firestore.googleapis.com/google.firestore.v1.Firestore/Listen/channel?VER=8&database=projects%2Fbare-ai%2Fdatabases%2F(default)&RID=28518&CVER=22&X-HTTP-Session-Id=gsessionid&zx=lpcnuoa6aknn&t=1, _kCFStreamErrorDomainKey=4}

⚡️  [log] - [2025-04-09T01:19:09.630Z]  @firebase/firestore: Firestore (11.6.0): FirebaseAuthCredentialsProvider Auth detected
⚡️  [log] - [2025-04-09T01:19:09.631Z]  @firebase/firestore: Firestore (11.6.0): FirestoreClient Received user= null
⚡️  [log] - [2025-04-09T01:19:09.631Z]  @firebase/firestore: Firestore (11.6.0): FirestoreClient Using default OnlineComponentProvider
⚡️  [log] - [2025-04-09T01:19:09.632Z]  @firebase/firestore: Firestore (11.6.0): FirestoreClient Using default OfflineComponentProvider
⚡️  [log] - [2025-04-09T01:19:09.632Z]  @firebase/firestore: Firestore (11.6.0): FirestoreClient Initializing OfflineComponentProvider
⚡️  [log] - [2025-04-09T01:19:09.634Z]  @firebase/firestore: Firestore (11.6.0): FirestoreClient Initializing OnlineComponentProvider
⚡️  [log] - [2025-04-09T01:19:09.638Z]  @firebase/firestore: Firestore (11.6.0): MemoryPersistence Starting transaction: Allocate target
⚡️  [log] - [2025-04-09T01:19:09.639Z]  @firebase/firestore: Firestore (11.6.0): MemoryPersistence Starting transaction: Execute query
⚡️  [warn] - [2025-04-09T01:19:12.689Z]  @firebase/firestore: Firestore (11.6.0): WebChannelConnection RPC 'Listen' stream 0x55cff3b9 transport errored: 
⚡️  [log] - [2025-04-09T01:19:12.689Z]  @firebase/firestore: Firestore (11.6.0): PersistentStream close with error: FirebaseError: [code=unavailable]: The operation could not be completed
⚡️  [log] - [2025-04-09T01:19:12.689Z]  @firebase/firestore: Firestore (11.6.0): OnlineStateTracker Could not reach Cloud Firestore backend. Connection failed 1 times. Most recent error: FirebaseError: [code=unavailable]: The operation could not be completed
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
⚡️  [log] - [2025-04-09T01:19:12.689Z]  @firebase/firestore: Firestore (11.6.0): ExponentialBackoff Backing off for 2161 ms (base delay: 2250 ms, delay with jitter: 2247 ms, last attempt: 86 ms ago)
⚡️  [log] - [2025-04-09T01:19:12.690Z]  @firebase/firestore: Firestore (11.6.0): MemoryPersistence Starting transaction: Release target
⚡️  [log] - [2025-04-09T01:19:14.851Z]  @firebase/firestore: Firestore (11.6.0): WebChannelConnection Creating RPC 'Listen' stream 0x55cff3ba: https://firestore.googleapis.com/google.firestore.v1.Firestore/Listen/channel {"httpSessionIdParam":"gsessionid","initMessageHeaders":{"X-Goog-Api-Client":"gl-js/ fire/11.6.0","Content-Type":"text/plain","X-Firebase-GMPID":"1:558298752854:web:053b4b25cce33f50d2d8f7"},"messageUrlParams":{"database":"(default)"},"sendRawJson":true,"supportsCrossDomainXhr":true,"internalChannelParams":{"forwardChannelRequestTimeoutMs":600000},"forceLongPolling":true,"detectBufferingProxy":false,"encodeInitMessageHeaders":true}
⚡️  [log] - [2025-04-09T01:19:10.664Z]  @firebase/firestore: Firestore (11.6.0): ExponentialBackoff Backing off for 1939 ms (base delay: 1500 ms, delay with jitter: 2031 ms, last attempt: 92 ms ago)
⚡️  [log] - [2025-04-09T01:19:10.664Z]  @firebase/firestore: Firestore (11.6.0): MemoryPersistence Starting transaction: Release target
⚡️  [log] - [2025-04-09T01:19:10.665Z]  @firebase/firestore: Firestore (11.6.0): MemoryPersistence Starting transaction: Release target
⚡️  [log] - [2025-04-09T01:19:10.665Z]  @firebase/firestore: Firestore (11.6.0): MemoryPersistence Starting transaction: Release target
⚡️  [log] - [2025-04-09T01:19:10.668Z]  @firebase/firestore: Firestore (11.6.0): MemoryPersistence Starting transaction: Allocate target
⚡️  [log] - [2025-04-09T01:19:10.668Z]  @firebase/firestore: Firestore (11.6.0): MemoryPersistence Starting transaction: Execute query

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
PODS:
  - Capacitor (7.2.0):
    - CapacitorCordova
  - CapacitorApp (7.0.1):
    - Capacitor
  - CapacitorCamera (7.0.1):
    - Capacitor
  - CapacitorCordova (7.2.0)
  - CapacitorHaptics (7.0.1):
    - Capacitor
  - CapacitorKeyboard (7.0.1):
    - Capacitor
  - CapacitorStatusBar (7.0.1):
    - Capacitor

DEPENDENCIES:
  - "Capacitor (from `../../node_modules/@capacitor/ios`)"
  - "CapacitorApp (from `../../node_modules/@capacitor/app`)"
  - "CapacitorCamera (from `../../node_modules/@capacitor/camera`)"
  - "CapacitorCordova (from `../../node_modules/@capacitor/ios`)"
  - "CapacitorHaptics (from `../../node_modules/@capacitor/haptics`)"
  - "CapacitorKeyboard (from `../../node_modules/@capacitor/keyboard`)"
  - "CapacitorStatusBar (from `../../node_modules/@capacitor/status-bar`)"

EXTERNAL SOURCES:
  Capacitor:
    :path: "../../node_modules/@capacitor/ios"
  CapacitorApp:
    :path: "../../node_modules/@capacitor/app"
  CapacitorCamera:
    :path: "../../node_modules/@capacitor/camera"
  CapacitorCordova:
    :path: "../../node_modules/@capacitor/ios"
  CapacitorHaptics:
    :path: "../../node_modules/@capacitor/haptics"
  CapacitorKeyboard:
    :path: "../../node_modules/@capacitor/keyboard"
  CapacitorStatusBar:
    :path: "../../node_modules/@capacitor/status-bar"

SPEC CHECKSUMS:
  Capacitor: 106e7a4205f4618d582b886a975657c61179138d
  CapacitorApp: d63334c052278caf5d81585d80b21905c6f93f39
  CapacitorCamera: eb8687d8687fed853598ec9460d94bcd5e16babe
  CapacitorCordova: 5967b9ba03915ef1d585469d6e31f31dc49be96f
  CapacitorHaptics: 70e47470fa1a6bd6338cd102552e3846b7f9a1b3
  CapacitorKeyboard: 969647d0ca2e5c737d7300088e2517aa832434e2
  CapacitorStatusBar: 275cbf2f4dfc00388f519ef80c7ec22edda342c9

PODFILE CHECKSUM: 5af67fe37e4aa4c9b3121a66d709689fe6e4b81a

COCOAPODS: 1.16.2

@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@paulb777
Copy link
Member

This looks like a Firestore variation of #14677. cc: @ncooke3

@paulb777
Copy link
Member

This may not be the right repository for this issue. Where is the NSURLSession usage coming from? Capacitor? Wherever it is may need a similar workaround as discussed in #14677.

@khaelou
Copy link
Author

khaelou commented Apr 15, 2025

@paulb777 You may be right, it seems I've been able to come up with a workaround in @ionic-team/capacitor which atleast allows Firestore to connect.

@paulb777
Copy link
Member

Sounds good. I'll close for now, but feel free to reopen if you find something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants