{"action":"opened","issue":{"url":"https://api.github.com/repos/couchbaselabs/sync_gateway_admin_ui/issues/20","labels_url":"https://api.github.com/repos/couchbaselabs/sync_gateway_admin_ui/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/couchbaselabs/sync_gateway_admin_ui/issues/20/comments","events_url":"https://api.github.com/repos/couchbaselabs/sync_gateway_admin_ui/issues/20/events","html_url":"https://github.com/couchbaselabs/sync_gateway_admin_ui/issues/20","id":99496645,"number":20,"title":"JS errors when loading admin UI with custom Sync Function","user":{"login":"jamiltz","id":2589337,"avatar_url":"https://avatars.githubusercontent.com/u/2589337?v=3","gravatar_id":"","url":"https://api.github.com/users/jamiltz","html_url":"https://github.com/jamiltz","followers_url":"https://api.github.com/users/jamiltz/followers","following_url":"https://api.github.com/users/jamiltz/following{/other_user}","gists_url":"https://api.github.com/users/jamiltz/gists{/gist_id}","starred_url":"https://api.github.com/users/jamiltz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamiltz/subscriptions","organizations_url":"https://api.github.com/users/jamiltz/orgs","repos_url":"https://api.github.com/users/jamiltz/repos","events_url":"https://api.github.com/users/jamiltz/events{/privacy}","received_events_url":"https://api.github.com/users/jamiltz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-06T18:25:43Z","updated_at":"2015-08-06T18:25:43Z","closed_at":null,"body":"Using `log` and `_` in the sync function causes JS errors when loading the admin UI.\r\n\r\nFor the following:\r\n\r\n```javascript\r\nfunction(doc, oldDoc) {\r\n  log(_.values(doc));\r\n  log(_.values(oldDoc));\r\n  if (oldDoc) {\r\n    delete oldDoc._rev;\r\n    delete doc._rev;\r\n  }\r\n  if (_.isEqual(doc, oldDoc)) {\r\n    throw({forbidden: \"There are no changes\"});\r\n  }\r\n}\r\n```\r\n\r\nOutput in chrome console:\r\n```\r\nUncaught ReferenceError: log is not defined\r\n```\r\n\r\nand\r\n\r\n```\r\nUncaught ReferenceError: _ is not defined\r\n```"}}