- I am trying to connect to our Couchbase database from a Flutter application.
- I installed the couchbase database on AWS http://x.x.x.198 (aws-marketplace/couchbase6.5.0-UbuntuLTS18.04)
- I installed the sync gateway on separate AWS instance http://x.x.x
The sync gateway config file :
{
"logging": {
"console": {
"log_keys": ["*"]
}
},
"CORS": {
"Origin": [
"*"
],
"LoginOrigin": [
"*"
],
"Headers": [
"Content-Type"
],
"MaxAge": 1728000
},
"adminInterface": "127.0.0.1:4985",
"interface": "0.0.0.0:4984",
"databases": {
"XXX": {
"server": "ec2-x-x-x-198.eu-west-2.compute.amazonaws.com:8091/",
"bucket": "XXX",
"username": "XXX",
"password": "*************",
"enable_shared_bucket_access": true,
"import_docs": true,
"users": {
"GUEST": {
"disabled": true
},
"randr_public": {
"password": "********************",
"email": "*****************",
"admin_channels": [
"randr_public"
]
}
},
"use_views": true,
"sync": "function (doc, oldDoc) {if (doc._deleted) { return; } requireAccess(doc.channels); channel(doc.channels);}"
}
}
}
I get the following error in Flutter code :
E/CouchbaseLite/REPLICATOR(17577): {Repl#12}==> N8litecore4repl10ReplicatorE /data/user/0/com.registerandrecall.randrbuild/files/rr_public.cblite2/ ->ws://ec2-18-x-x-198.eu-west-2.compute.amazonaws.com:4984/randr/_blipsync @0x7cca31fac8
E/CouchbaseLite/REPLICATOR(17577): {Repl#12} Got LiteCore error: WebSocket error 1001 "WebSocket connection closed by peer"
I/call.randrbuil(17577): Waiting for a blocking GC ProfileSaver
I/call.randrbuil(17577): WaitForGcToComplete blocked ProfileSaver on HeapTrim for 19.579ms
E/CouchbaseLite/REPLICATOR(17577): {Repl#13}==> N8litecore4repl10ReplicatorE /data/user/0/com.registerandrecall.randrbuild/files/rr_public.cblite2/ ->ws://ec2-18-x-x-198.eu-west-2.compute.amazonaws.com:4984/randr/_blipsync @0x7d447368c8
E/CouchbaseLite/REPLICATOR(17577): {Repl#13} Got LiteCore error: WebSocket error 1001 "WebSocket connection closed by peer"
I/flutter (17577): start notification management for android ...
I/flutter (17577): Replocator -> ReplicatorActivityLevel.connecting
I/flutter (17577): Error in replicator: WebSocket connection closed by peer
I/flutter (17577): Replocator -> ReplicatorActivityLevel.connecting
I/flutter (17577): Error in replicator: WebSocket connection closed by peer
I/flutter (17577): Replocator -> ReplicatorActivityLevel.offline
I/flutter (17577): Replocator -> ReplicatorActivityLevel.connecting
I/flutter (17577): Error in replicator: WebSocket connection closed by peer
I/flutter (17577): Replocator -> ReplicatorActivityLevel.connecting
I/flutter (17577): Error in replicator: WebSocket connection closed by peer
I/flutter (17577): Replocator -> ReplicatorActivityLevel.offline
I/flutter (17577): Replocator -> ReplicatorActivityLevel.connecting
E/CouchbaseLite/REPLICATOR(17577): {Repl#14}==> N8litecore4repl10ReplicatorE /data/user/0/com.registerandrecall.randrbuild/files/rr_public.cblite2/ ->ws://ec2-18-134-140-198.eu-west-2.compute.amazonaws.com:4984/randr/_blipsync @0x7d447363c8
E/CouchbaseLite/REPLICATOR(17577): {Repl#14} Got LiteCore error: WebSocket error 1001 "WebSocket connection closed by peer"
I/flutter (17577): Error in replicator: WebSocket connection closed by peer
I/flutter (17577): Replocator -> ReplicatorActivityLevel.connecting
I/flutter (17577): Error in replicator: WebSocket connection closed by peer
I/flutter (17577): Replocator -> ReplicatorActivityLevel.offline
Sync gateway is running on correct port :
ubuntu@ip-x-x-x-195:/home/sync_gateway$ sudo lsof -i -P -n | grep LISTEN
systemd-r 735 systemd-resolve 13u IPv4 17323 0t0 TCP 127.0.0.53:53 (LISTEN)
sshd 1093 root 3u IPv4 20932 0t0 TCP *:22 (LISTEN)
sshd 1093 root 4u IPv6 20943 0t0 TCP *:22 (LISTEN)
sync_gate 12877 sync_gateway 11u IPv6 144840 0t0 TCP *:4984 (LISTEN)
sync_gate 12877 sync_gateway 16u IPv4 144842 0t0 TCP 127.0.0.1:4985 (LISTEN)
and the sg_info.log
2020-11-20T09:58:52.251Z [INF] DCP: c:randr-SGI Restarting vb 1019 using metadata sequence 4 (backfill 0 not in [4-4])
2020-11-20T09:58:52.252Z [INF] DCP: c:randr-SGI Restarting vb 1020 using metadata sequence 6 (backfill 6 not in [6-6])
2020-11-20T09:58:52.252Z [INF] DCP: c:randr-SGI Restarting vb 1021 using metadata sequence 6 (backfill 0 not in [6-6])
2020-11-20T09:58:52.252Z [INF] DCP: c:randr-SGI Restarting vb 1022 using metadata sequence 0 (backfill 0 not in [0-0])
2020-11-20T09:58:52.253Z [INF] DCP: c:randr-SGI Restarting vb 1023 using metadata sequence 5 (backfill 0 not in [5-5])
2020-11-20T09:58:52.253Z [INF] DCP: c:randr-SGI DCP feed starting with name SGI-v-2.8-commit--uuid-fe698846-2b16-11eb-bd8c-02227b0cd494
2020-11-20T09:58:52.253Z [INF] DCP: Starting mutation feed on bucket randr due to either channel cache mode or doc tracking (auto-import)
2020-11-20T09:58:52.253Z [INF] DCP: Using DCP feed for bucket: "randr" (based on feed_type specified in config file)
2020-11-20T09:58:52.287Z [INF] CBGoUtilsLogger: Using plain authentication for user <ud>randr</ud>
2020-11-20T09:58:52.300Z [INF] DCP: c:randr-SG DCP feed starting with name SG-v-2.8-commit--uuid-fe70c24a-2b16-11eb-bd8c-02227b0cd494
2020-11-20T09:58:52.301Z [INF] Cache: Waiting 976.270155ms for sequence allocation...
2020-11-20T09:58:52.340Z [INF] CBGoUtilsLogger: Using plain authentication for user <ud>randr</ud>
2020-11-20T09:58:52.387Z [INF] DCP: Backfill in progress: 0% (1 / 1882)
2020-11-20T09:58:53.283Z [INF] Using metadata purge interval of 3.00 days for tombstone compaction.
2020-11-20T09:58:53.283Z [INF] Created background task: "Compact" with interval 24h0m0s
2020-11-20T09:58:53.353Z [INF] Access: Computed roles for "":
2020-11-20T09:58:53.355Z [INF] Auth: Saved principal w/ name:, seq: #1198
2020-11-20T09:58:53.355Z [INF] Reset guest user to config
2020-11-20T09:58:53.356Z [INF] DCP: Received #1198 ("_user/")
2020-11-20T09:58:53.356Z [INF] Starting admin server on 127.0.0.1:4985
2020-11-20T09:58:53.358Z [INF] Starting server on 0.0.0.0:4984 ...
2020-11-20T09:58:58.360Z [INF] Replicate: Starting sg-replicate replications...