{"action":"closed","issue":{"url":"https://api.github.com/repos/couchbase/sync_gateway/issues/3273","repository_url":"https://api.github.com/repos/couchbase/sync_gateway","labels_url":"https://api.github.com/repos/couchbase/sync_gateway/issues/3273/labels{/name}","comments_url":"https://api.github.com/repos/couchbase/sync_gateway/issues/3273/comments","events_url":"https://api.github.com/repos/couchbase/sync_gateway/issues/3273/events","html_url":"https://github.com/couchbase/sync_gateway/issues/3273","id":294324617,"number":3273,"title":"Tons of warning messages about errors parsing body of revisions","user":{"login":"nbrys","id":10546183,"avatar_url":"https://avatars1.githubusercontent.com/u/10546183?v=4","gravatar_id":"","url":"https://api.github.com/users/nbrys","html_url":"https://github.com/nbrys","followers_url":"https://api.github.com/users/nbrys/followers","following_url":"https://api.github.com/users/nbrys/following{/other_user}","gists_url":"https://api.github.com/users/nbrys/gists{/gist_id}","starred_url":"https://api.github.com/users/nbrys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbrys/subscriptions","organizations_url":"https://api.github.com/users/nbrys/orgs","repos_url":"https://api.github.com/users/nbrys/repos","events_url":"https://api.github.com/users/nbrys/events{/privacy}","received_events_url":"https://api.github.com/users/nbrys/received_events","type":"User","site_admin":false},"labels":[{"id":54082900,"url":"https://api.github.com/repos/couchbase/sync_gateway/labels/needsmoreinfo","name":"needsmoreinfo","color":"fbca04","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-02-05T09:29:53Z","updated_at":"2018-02-20T18:12:28Z","closed_at":"2018-02-20T18:12:28Z","author_association":"NONE","body":"### Sync Gateway version\r\n1.5.1 Community Edition \r\n\r\n### Couchbase Version\r\n4.5.1 Community Edition\r\n\r\n### Operating system\r\nUbuntu 14.04\r\n\r\n### Config file\r\n```{\r\n      \"interface\": \":4984\",\r\n      \"adminInterface\": \":4985\",\r\n      \"log\": [\"REST\"],\r\n      \"databases\": {\r\n        \"customerDB\": {\r\n              \"server\": \"http://<%= @couchbase_elb %>:8091\",\r\n              \"bucket\": \"customerDB\",\r\n              \"feed_type\": \"TAP\",\r\n              \"rev_cache_size\": 10,\r\n              \"cache\": {\r\n                \"channel_cache_max_length\": 10,\r\n                \"channel_cache_min_length\": 10\r\n\t          },\r\n              \"sync\": `\r\nfunction(doc, oldDoc) {\r\n\r\n    if (doc._id.charAt(0) === '_') {\r\n        return;\r\n    }\r\n\r\n    var isAdmin = false;\r\n    if (realUserCtx.channels === undefined && realUserCtx.roles === undefined) {\r\n    \t// The only way to have an empty realUserCtx is by accessing the admin REST api (4985)\r\n    \t// This should only be accessible from the inside so we can assume all users doing this to be admin.\r\n\t\tisAdmin = true;\r\n    } else {\r\n    \tisAdmin = realUserCtx.channels.indexOf('*') != -1;\r\n    }\r\n\r\n    var noAssignee = 'no_assignee';\r\n    var currentAssignee = (doc && doc.assignees && doc.assignees.length > 0) ? doc.assignees.substring(doc.assignees.indexOf(':') + 1) : noAssignee;\r\n    var oldAssignee = (oldDoc && oldDoc.assignees && oldDoc.assignees.length > 0) ? oldDoc.assignees.substring(oldDoc.assignees.indexOf(':') + 1) : noAssignee;\r\n\r\n    // Handle deleted documents\r\n    if (doc._deleted) {\r\n        if (!isAdmin) {\r\n            if (oldAssignee) {\r\n                requireAccess(oldAssignee);\r\n            } else {\r\n                requireRole('role:admin');\r\n            }\r\n        }\r\n        return;\r\n    }\r\n\r\n    var allAppsID = '_all';\r\n\r\n    // Reject documents without a type\r\n    if (!doc.type) {\r\n        throw ({\r\n            forbidden: 'document type missing'\r\n        });\r\n    }\r\n\r\n    // Users (com.id.user:<username>)\r\n    if (doc.type === 'user') {\r\n        var username = doc._id.substring(doc._id.indexOf(':') + 1);\r\n\r\n        // MODIFY: Allow users to only update their own user document.\r\n        if (!isAdmin) {\r\n            requireAccess(username);\r\n        }\r\n\r\n        // SYNC: Assign the document to the channel of the user.\r\n        channel(username);\r\n        channel(username + '_' + allAppsID);\r\n\r\n        // ACCESS: Grant access to the channels corresponding to the apps in the list.\r\n        if (doc.apps) {\r\n        \tfor (var i in doc.apps) {\r\n        \t\tvar appid = doc.apps[i];\r\n        \t\taccess(username, username + '_' + appid);\r\n    \t\t\taccess(username, noAssignee + '_' + appid);\r\n    \t\t\taccess(username, '__config_' + appid);\r\n        \t}\r\n\r\n        \taccess(username, username + '_' + allAppsID);\r\n\t\t\taccess(username, noAssignee + '_' + allAppsID);\r\n\t\t\taccess(username, '__config');\r\n\t\t\taccess(username, '__config_' + allAppsID);\r\n        }\r\n\r\n        return;\r\n    }\r\n\r\n    if (!isAdmin) {\r\n        if (currentAssignee === noAssignee) {\r\n            // MODIFY: Only channel admins can modify no-assignee documents\r\n\t\t\trequireRole('role:admin');\r\n        } else {\r\n            // MODIFY: Only the assigned user or admin can modify his documents.\r\n            requireAccess(currentAssignee);\r\n        }\r\n    }\r\n\r\n\tvar appid = (doc && doc.appid) ? doc.appid : allAppsID;\r\n\r\n    // SYNC: Assign the document to the channel of the assigned user.\r\n    channel(currentAssignee);\r\n    channel(currentAssignee + '_' + appid);\r\n\r\n    // Utility channels:\r\n    if (doc.type === 'form-instance') {\r\n        // Enforce status field on documents\r\n        if (!doc.status) {\r\n            throw ({\r\n                forbidden: 'form instances should have a status field'\r\n            });\r\n        }\r\n\r\n        // SYNC: Assign the document to the __status_<status> channel.\r\n        channel('__status_' + doc.status);\r\n        channel('__status_' + doc.status + '_' + appid);\r\n    } else if (doc.type === 'key-request') {\r\n        // SYNC: Assign keyrequests to the __keyrequests channel.\r\n        channel('__keyrequests');\r\n        channel('__keyrequests_' + appid);\r\n    } else if (doc._id.indexOf('com.id.config:') === 0) {\r\n        // SYNC: Assign configurations to the configuration channel.\r\n        channel('__config');\r\n        channel('__config_' + appid);\r\n    }\r\n    channel('__type_' + doc.type);\r\n    channel('__type_' + doc.type + '_' + appid);\r\n}\r\n\t\t`\r\n        }\r\n```\r\n\r\n### Log output\r\nhttps://gist.github.com/nbrys/fdadfb664e7e18a20494a5fa63b1ebc3\r\n\r\n### Expected behavior\r\nNo messages\r\n\r\n### Actual behavior\r\nWe think these are obsoleted documents. There should be no messages about these documents.\r\n\r\n### Steps to reproduce\r\n\r\n"}}
{"actor":{"display_login":"adamcfraser"}}