firebase / firebase/firebase-ios-sdk

Firestore networking error when reading but is able to write documents

Open
#13,644 30 comments 3 reactions 1 assignee Claimed by @milaGGL View on GitHub
api: firestore
Dominant language
C++
Stars
6.7k
Forks
1.8k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description

When trying to read documents in a collection or setting up a listener, I am getting a networking error. However, I am able to write and create docs so network is available. I see the created docs via the console.

Read error occurs on both simulator (iPhone 17.5) and device (iPad 18.1 Beta)

```
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1726469557.131855 4311892 config.cc:230] gRPC experiments enabled: call_status_override_on_cancellation, http2_stats_fix, monitoring_experiment, pick_first_new, trace_record_callops, work_serializer_clears_time_cache
Error get collectionSnapshot for mycollection (null)
NSBundle file:///System/Library/PrivateFrameworks/MetalTools.framework/ principal class is nil because all fallbacks have failed
nw_endpoint_flow_failed_with_error [C3 2607:f8b0:4005:806::200a.443 failed parent-flow (unsatisfied (No network route), ipv4, dns)] already failing, returning
nw_connection_get_connected_socket_block_invoke [C3] Client called nw_connection_get_connected_socket on unconnected nw_connection
TCP Conn 0x302011220 Failed : error 0:50 [50]
I0000 00:00:1726469557.819759 4311922 subchannel.cc:806] subchannel 0x105257c00 {address=ipv6:%5B2607:f8b0:4005:806::200a%5D:443, args={grpc.client_channel_factory=0x3013178d0, grpc.default_authority=firestore.googleapis.com, grpc.http2_scheme=https, grpc.internal.channel_credentials=0x30352c960, grpc.internal.client_channel_call_destination=0x102d9f4a8, grpc.internal.event_engine=0x301332490, grpc.internal.security_connector=0x303f08b80, grpc.internal.subchannel_pool=0x303a111f0, grpc.keepalive_time_ms=30000, grpc.primary_user_agent=grpc-c++/1.65.1, grpc.resource_quota=0x301fa8720, grpc.server_uri=dns:///firestore.googleapis.com}}: connect failed (UNKNOWN:(domain:NSPOSIXErrorDomain, code:50, description:The operation couldn’t be completed. Network is down) {grpc_status:2, created_time:"2024-09-15T23:52:37.81969-07:00", file_line:150, file:"/var/folders/hn/5bx1f4_d4ds5vhwhkxc7vdcr0000gn/T/ZipRelease/2024-07-25T04-01-28/project-ios/Pods/gRPC-Core/src/core/lib/transport/error_utils.cc"}), backing off for 994 ms

```

Found a Stackoverflow thread reporting exact same issue as mine -> https://stackoverflow.com/questions/78929426/swiftui-with-firebasefirestore

### Reproducing the issue

It's a very basic project that writes a document to a one level collection and then tries to read an array of docs from that collection and tries to setup a snapshot listener.

### Firebase SDK Version

11.2.0

### Xcode Version

15.4

### Installation Method

Swift Package Manager

### Firebase Product(s)

Firestore

### Targeted Platforms

iOS

### Relevant Log Output

_No response_

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

Expand Package.resolved snippet

```json

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

```

### If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet

```yml

Replace this line with the contents of your Podfile.lock!

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.