"cannot parse response" error in couchbase-lite from replication to / from Sync Gateway

Couchbase-lite occasionally throws the following error for push/pull replication to/from Sync Gateway:

Error Domain=NSURLErrorDomain Code=-1017 \"cannot parse response\" 
UserInfo={_kCFStreamErrorCodeKey=-1, NSUnderlyingError=0x281c7fe40 {Error Domain=kCFErrorDomainCFNetwork 
Code=-1017 \"(null)\" UserInfo={_kCFStreamErrorCodeKey=-1, _kCFStreamErrorDomainKey=4}}, 
LocalDataTask <28CF39CD-C435-4DA1-AAAF-C28FACB61F83>.<185>,
 _NSURLErrorRelatedURLSessionTaskErrorKey=(\\n    \"
LocalDataTask <28CF39CD-C435-4DA1-AAAF-C28FACB61F83>.<185>\"\\n), 
NSLocalizedDescription=cannot parse response, 
 NSErrorFailingURLKey=https://sync.prod.union.union-pos.net/db/_revs_diff, _kCFStreamErrorDomainKey=4

Endpoints that result in such error are:

The error is not consistent and overall replication works, although that might result in delayed replication from SG to Couchbase-Lite and vice versa.

Has anyone experienced this issue or have any knowledge on what could be the cause for this?

Couchbase-Lite: v1.4.4; iOS (14.5.1, 14.6, 14.7. 14.7.1, 14.8)
Sync Gateway: v2.1
Couchbase Server: v6.5.0 build 4960

Have you checked out our CBL 2.x Couchbase Lite on Swift | Couchbase Docs? 1.x is EOL.

We would love to switch to CBL 2.x, but it doesn’t support p2p replication, as far as I know. That feature is critical to us.

CBL2.x enterprise edition offers P2P feature.
You can contact @priya.rajagopal if you would like to know more about it.

That’s good news. Thanks for referring a contact. Will reach them right away.