Hi,
I have set up the the sync gateway there is no default collection or scope for the sync gateway database only the dev scope and custom collections. Direct api call work fine, PouchDB can be made to work albeit using a proxy technique and per collection listeners.
I want to get Couchbase Lite to work. I am forking the community example for ReactNative but I will be modifying DatabaseMananger.java it to accept scopes and collections. The issue is even after I add the custom collection it keep referring to the _default collection
The version of the sync_gateway is
CouchbaseLite/3.1.6-2
Couchbase Sync Gateway/3.1.1 CE
So both of these support custom scopes and collections
I was able to connect to a different sync database with a default collection but I don’t want to do that.
This is the log
ReplicatorID 3bb76eb6b04407d84474afd80bcf5de6
LOG Replicator Listener Response Replicator listener already exists
LOG replicator started Success
LOG Replicator Event : {"completed": 0, "status": "connecting", "total": 0}
LOG Replicator Event : {"completed": 0, "status": "connecting", "total": 0}
LOG Replicator Event : {"completed": 0, "status": "connecting", "total": 0}
LOG Replicator Event : {"completed": 0, "status": "busy", "total": 0}
LOG Replicator Event : {"completed": 0, "status": "busy", "total": 0}
LOG Replicator Event : {"completed": 0, "status": "busy", "total": 0}
LOG User is not authorized to sync with remote server. Check credentials and try again.
LOG Replicator Event : {"completed": 0, "error": "Collection '_default' is not found on the remote server
(CouchbaseLite Android v3.1.6-2@33 (EE/release, Commit/85eee67315@eb3d346290fb Core/3.1.6 (6) at 2024-02-28T22:56:19.938904494Z) on Java; Android 10; SM-G960F)", "errorCode": 10404, "status": "stopped", "total": 0}
LOG User is not authorized to sync with remote server. Check credentials and try again.
LOG Replicator Event : {"completed": 0, "error": "Collection '_default' is not found on the remote server
(CouchbaseLite Android v3.1.6-2@33 (EE/release, Commit/85eee67315@eb3d346290fb Core/3.1.6 (6) at 2024-02-28T22:56:19.938904494Z) on Java; Android 10; SM-G960F)", "errorCode": 10404, "status": "stopped", "total": 0}
LOG User is not authorized to sync with remote server. Check credentials and try again.
LOG Replicator Event : {"completed": 0, "error": "Collection '_default' is not found on the remote server
(CouchbaseLite Android v3.1.6-2@33 (EE/release, Commit/85eee67315@eb3d346290fb Core/3.1.6 (6) at 2024-02-28T22:56:19.938904494Z) on Java; Android 10; SM-G960F)", "errorCode": 10404, "status": "stopped", "total": 0}
This is captured netwrok traffic
GET /atender-d/_blipsync HTTP/1.1
Host: [bla]:4984
User-Agent: CouchbaseLite/3.1.6-2 (Java; Android 10; SM-G960F) EE/release, Commit/85eee67315@eb3d346290fb Core/3.1.6 (6)
Sec-WebSocket-Protocol: BLIP_3+CBMobile_3,BLIP_3+CBMobile_2
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: qo3IIAPq6p6YWYYlFC5P5Q==
Sec-WebSocket-Version: 13
Sec-WebSocket-Extensions: permessage-deflate
Authorization: Basic [bla]
Accept-Encoding: gzip
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Sec-Websocket-Accept: KJW+L2lrY+iBUdPXZZ8IEPms9Vo=
Sec-Websocket-Protocol: BLIP_3+CBMobile_3
Server: Couchbase Sync Gateway/3.1.1 CE
Upgrade: websocket
�4 �(��� Content-Type�application/json�[{},null]��Ÿ
I’m essentially doing this in getReplicatorConfig
(albeit parsing a config)
com.couchbase.lite.Collection currentCollection = database.createCollection("member-info", "dev");
config.addCollection(currentCollection, null);
The weird thing is in ~sync_gateway/logs/sg_info.log
2024-04-26T13:15:15.325+01:00 [INF] HTTP: c:#018 db:atender-d GET /atender-d/_blipsync (as <ud>test1@test.com</ud>)
2024-04-26T13:15:15.325+01:00 [INF] HTTP+: c:[4c043212] #018: --> 101 [4c043212] Upgraded to WebSocket protocol BLIP_3+ (as <ud>test1@test.com</ud>) (0.0 ms)
2024-04-26T13:15:15.325+01:00 [INF] WS: c:#018 db:atender-d Start BLIP/Websocket handler
2024-04-26T13:15:15.336+01:00 [INF] SyncMsg: #1: Type:getCollections Collections: [dev.member-info _default], CheckpointIds: [cp-YrJpZ/wmssH/k1Tfu2WQzkiLkdkVRe2oznTV+1/tV04= cp-V/HrjqSGWqu8P3Mr008KeDNgqhs=]
2024-04-26T13:15:15.394+01:00 [INF] HTTP: c:[4c043212] #018: --> BLIP+WebSocket connection closed
Why is it [dev.member-info _default]
? it should be just [dev.member-info]
right?
If tried database.deleteCollection
and/or config.removeCollection
to try an remove the default collection but these produce null reference errors. I don’t want to get into a cargo cult situation, I can’t figure out where I’m goign wrong.
default collection is mutually exclusive to custom collections and scopes for the sync gateway according to your documentation you would need a different database per scope as far as I understand but could target the same bucket in Couchbase server. I’m only trying to replicate one scope and various collections in the one sync database that doesn’t have a default collection for obvious reasons.
Your documentation also implies that scope and collections in Couchbase Lite need to match on sync server. Am I missing anything?
The credential are correct and verified through the other approaches.
Thank you in advance.