CouchbaseLite failing to connect to sync gateway WebSocket through AWS Application Load balancer

Hi

I’ve created an AWS Application Load Balancer and am trying to connect to Couchbase Lite replication through it using web sockets and its failing to work.

The couchbase lite logs are below.
You can see various errors including:
2020-11-13 14:14:37.286147+0000 myapp.iOS[97339:5536486] [Thread Pool Worker]| INFO) [Replicator] (WebSocketWrapper) [Thread Pool Worker (8)] WebSocket CLOSED WITH STATUS WebSocketClosePolicyError “OK”

It works fine going to direct to the sync gateway instance rather than via the load balancer

Any help would be appreciated
Andy

2020-11-13 14:14:36.923627+0000 myapp.iOS[97339:5536337] [12]| INFO) [Replicator] {Repl#5} Scanning for pre-existing conflicts…

2020-11-13 14:14:36.923831+0000 myapp.iOS[97339:5536337] [12]| INFO) [Replicator] {Repl#5} Found 0 conflicted docs in 0.001 sec

2020-11-13 14:14:36.924563+0000 myapp.iOS[97339:5536337] [12]| VERBOSE) [Replicator] {Repl#5} Remote-DB ID 1 found for target ws://myloadbalancer.us-west-2.elb.amazonaws.com:4984/myapp/_blipsync

2020-11-13 14:14:36.925184+0000 myapp.iOS[97339:5536337] [12]| INFO) [Replicator] {Repl#5} No local checkpoint ‘cp-WlAbqhGV/J9AG75Y6WIdDxpPvP8=’

2020-11-13 14:14:36.925596+0000 myapp.iOS[97339:5536337] [12]| INFO) [Replicator] {Repl#5} activityLevel=connecting: connectionState=1

2020-11-13 14:14:36.925833+0000 myapp.iOS[97339:5536333] [11]| INFO) [Replicator] {Puller#7}==> litecore::repl::Puller ->ws://myloadbalancer.us-west-2.elb.amazonaws.com:4984/myapp/_blipsync @0x7fcd314a8818

2020-11-13 14:14:36.926258+0000 myapp.iOS[97339:5536333] [11]| INFO) [Replicator] {Puller#7} activityLevel=busy: pendingResponseCount=0, _caughtUp=0, _pendingRevMessages=0, _activeIncomingRevs=0

2020-11-13 14:14:36.926535+0000 myapp.iOS[97339:5536333] [11]| VERBOSE) [Replicator] {Puller#7} now busy

2020-11-13 14:14:36.926909+0000 myapp.iOS[97339:5536337] [12]| INFO) [Replicator] {Repl#5} pushStatus=busy, pullStatus=busy, progress=0/0

2020-11-13 14:14:36.927086+0000 myapp.iOS[97339:5536337] [12]| INFO) [Replicator] {Repl#5} activityLevel=connecting: connectionState=1

Thread finished: #15

Thread started: #16

2020-11-13 14:14:36.972112+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:14:36.972352+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:14:37.076411+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:14:37.076616+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

Thread started: #17

2020-11-13 14:14:37.111705+0000 myapp.iOS[97339:5536701] [19]| INFO) [Replicator] (WebSocketWrapper) [19] WebSocket connecting to myloadbalancer.us-west-2.elb.amazonaws.com:4984

Thread finished: #17

Thread started: #18

2020-11-13 14:14:37.125332+0000 myapp.iOS[97339:5536702] [20]| VERBOSE) [Replicator] (WebSocketWrapper) [20] WebSocket sent HTTP request…

Thread finished: #18

Thread started: #19

Thread started: #20

Thread started: #21

Thread finished: #20

2020-11-13 14:14:37.286147+0000 myapp.iOS[97339:5536486] [Thread Pool Worker]| INFO) [Replicator] (WebSocketWrapper) [Thread Pool Worker (8)] WebSocket CLOSED WITH STATUS WebSocketClosePolicyError “OK”

2020-11-13 14:14:37.287209+0000 myapp.iOS[97339:5536333] [11]| INFO) [Replicator] {Repl#5} activityLevel=connecting: connectionState=1

Thread started: #22

Thread finished: #22

2020-11-13 14:14:37.289635+0000 myapp.iOS[97339:5536587] [15]| INFO) [Replicator] {Repl#5} Connection closed with WebSocket status 1008: “OK” (state=1)

2020-11-13 14:14:37.289940+0000 myapp.iOS[97339:5536332] [13]| INFO) [Replicator] {Puller#7} activityLevel=stopped: pendingResponseCount=0, _caughtUp=0, _pendingRevMessages=0, _activeIncomingRevs=0

2020-11-13 14:14:37.290229+0000 myapp.iOS[97339:5536332] [13]| VERBOSE) [Replicator] {Puller#7} now stopped

2020-11-13 14:14:37.290661+0000 myapp.iOS[97339:5536333] [11]| INFO) [Replicator] {Pusher#8}==> litecore::repl::Pusher ->ws://myloadbalancer.us-west-2.elb.amazonaws.com:4984/myapp/_blipsync @0x7fcd31446988

2020-11-13 14:14:37.291053+0000 myapp.iOS[97339:5536587] [15]| ERROR) [Replicator] {Repl#5} Got LiteCore error: WebSocket error 1008 “OK”

2020-11-13 14:14:37.291974+0000 myapp.iOS[97339:5536333] [11]| INFO) [Replicator] {Pusher#8} activityLevel=stopped: pendingResponseCount=0, caughtUp=0, changeLists=0, revsInFlight=0, blobsInFlight=0, awaitingReply=0, revsToSend=0, pushingDocs=0, pendingSequences=0

Thread finished: #21

2020-11-13 14:14:37.293236+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:14:37.293490+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:14:37.292434+0000 myapp.iOS[97339:5536333] [11]| VERBOSE) [Replicator] {Pusher#8} now stopped

2020-11-13 14:14:37.298396+0000 myapp.iOS[97339:5536587] [15]| VERBOSE) [Replicator] {Repl#5} progress +0/+0, 0 docs – now 0 / 0, 0 docs

2020-11-13 14:14:37.300688+0000 myapp.iOS[97339:5536587] [15]| INFO) [Replicator] {Repl#5} activityLevel=connecting: connectionState=-1

2020-11-13 14:14:37.307847+0000 myapp.iOS[97339:5536587] [15]| INFO) [Replicator] (Replicator) [15] Replicator[<*> ws://myloadbalancer.us-west-2.elb.amazonaws.com:4984/myapp] is Connecting, progress 0/0

Thread started: #23

2020-11-13 14:14:37.309727+0000 myapp.iOS[97339:5536587] [15]| INFO) [Replicator] {Repl#5} pushStatus=busy, pullStatus=stopped, progress=0/0

2020-11-13 14:14:37.309915+0000 myapp.iOS[97339:5536587] [15]| INFO) [Replicator] {Repl#5} activityLevel=connecting: connectionState=-1

2020-11-13 14:14:37.310225+0000 myapp.iOS[97339:5536587] [15]| INFO) [Replicator] {Repl#5} pushStatus=stopped, pullStatus=stopped, progress=0/0

2020-11-13 14:14:37.310457+0000 myapp.iOS[97339:5536708] Error :: Couchbase.Lite.CouchbaseWebsocketException: CouchbaseLiteException (WebSocketDomain / 1008): OK.

Replication: Status Connecting Progress Couchbase.Lite.Sync.ReplicatorProgress

2020-11-13 14:14:37.310643+0000 myapp.iOS[97339:5536587] [15]| INFO) [Replicator] {Repl#5} activityLevel=stopped: connectionState=-1

Thread finished: #23

2020-11-13 14:14:37.311669+0000 myapp.iOS[97339:5536587] [15]| INFO) [Replicator] {Repl#5} now stopped

2020-11-13 14:14:37.311901+0000 myapp.iOS[97339:5536587] [15]| INFO) [Replicator] BLIP sent 0 msgs (0 bytes), rcvd 0 msgs (0 bytes) in 0.487 sec. Max outbox depth was 0, avg nan

2020-11-13 14:14:37.314885+0000 myapp.iOS[97339:5536587] [15]| INFO) [Replicator] (Replicator) [15] Permanent error encountered (WebSocketDomain / 1008), giving up…

2020-11-13 14:14:37.315247+0000 myapp.iOS[97339:5536587] [15]| INFO) [Replicator] (Replicator) [15] Replicator[<*> ws://myloadbalancer.us-west-2.elb.amazonaws.com:4984/myapp] is Stopped, progress 0/0

Thread started: #24

2020-11-13 14:14:37.317523+0000 myapp.iOS[97339:5536709] Error :: Couchbase.Lite.CouchbaseWebsocketException: CouchbaseLiteException (WebSocketDomain / 1008): OK.

Replication: Status Stopped Progress Couchbase.Lite.Sync.ReplicatorProgress

Thread finished: #24

2020-11-13 14:14:37.722878+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:14:37.723128+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:14:38.601924+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:14:38.602143+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:14:40.360286+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:14:40.360461+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

Thread finished: #7

2020-11-13 14:14:43.560448+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:14:43.560627+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:14:48.560693+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:14:48.560888+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:14:53.560648+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:14:53.560838+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:14:58.560632+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:14:58.560882+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:15:03.561080+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:15:03.561334+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

2020-11-13 14:15:08.561131+0000 myapp.iOS[97339:5536284] AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort” UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}

First thing to check is if websockets is enabled in your load balancer