Unable to get data in Query view via Users Port

I have created a new View via Admin REST API and i am able to see data only in Admin port (4985). When i query the view via Users Port (4984), i am getting total rows as 0.

SG Version: 1.3.1
Couchbase Server Version: 3.03

Note: I have custom Map and reduce function for the view

Below is the response i get.


Below is the response i get when running on Admin port.


My Sync Gateway config.json

“log”: [“CRUD”, “REST+”, “Access”],
“databases”: {
“sk”: {
“unsupported”: {
“user_views”: {
“enabled”: true
“oidc_test_provider”: {
“enabled”: false
“users”: {
“GUEST”: {
“disabled”: false, “admin_channels”: [" * “]
“CORS”: {
“Origin”: [”"],
“LoginOrigin”: ["
“Headers”: [“Content-Type”],
“MaxAge”: 1782000
“server”: “http://localhost:8091”,
“bucket”: “default”,
“sync”: “function(doc) { if(doc.catalogs) { for(var i = 0; i < doc.catalogs.length; i++) { channel(doc.catalogs[i]); } } }”

I have tried restarting the sync-gateway also. still not getting right data.
Need some help on getting data while querying view via user port.


Are you using the GUEST account to query the view on the public REST API?

Yes. For now, I am using GUEST account to query the view.

I have tried querying the view via user port as normal user (not GUEST). Still i get the same empty response

Just a reminder to the issue.
Any changes needs to be done in the config to overcome this issue ??

To verify channel access - is the user able to retrieve the docs you’re expecting to see in the view results using a direct GET over the REST API?

Actually - I see now that you mention you’ve got a reduce function defined for your custom view. Reduce isn’t currently supported for views queried through the public API, as Sync Gateway isn’t able to apply the appropriate channel filtering on the response.

Some details in the conversation on this ticket: