{"action":"created","issue":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/5943","repository_url":"https://api.github.com/repos/pouchdb/pouchdb","labels_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/5943/labels{/name}","comments_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/5943/comments","events_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/5943/events","html_url":"https://github.com/pouchdb/pouchdb/issues/5943","id":191767022,"number":5943,"title":"Safari websql buggy replication after recreating database","user":{"login":"aeharding","id":2166114,"avatar_url":"https://avatars.githubusercontent.com/u/2166114?v=3","gravatar_id":"","url":"https://api.github.com/users/aeharding","html_url":"https://github.com/aeharding","followers_url":"https://api.github.com/users/aeharding/followers","following_url":"https://api.github.com/users/aeharding/following{/other_user}","gists_url":"https://api.github.com/users/aeharding/gists{/gist_id}","starred_url":"https://api.github.com/users/aeharding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aeharding/subscriptions","organizations_url":"https://api.github.com/users/aeharding/orgs","repos_url":"https://api.github.com/users/aeharding/repos","events_url":"https://api.github.com/users/aeharding/events{/privacy}","received_events_url":"https://api.github.com/users/aeharding/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-11-25T21:31:38Z","updated_at":"2016-12-05T00:47:08Z","closed_at":"2016-12-05T00:47:08Z","body":"### Issue\r\n\r\nAfter recreating a DB in safari, replicating data doesn't work.\r\n\r\nI can consistently recreate this issue, but it's really hard to debug why this is happening since it's silently failing. :(\r\n\r\nSomething also weird. In the web inspector, I cannot click the \"Storage\" button to open the tab on my app after doing the above. I can open the storage inspector when on google.com though.\r\n\r\nAnother weird thing: It seems that if I edit add some documents to the db in safari after the issue arises and wait a long time (2-5 minutes), the db will start syncing and working well.\r\n\r\n### Info\r\n- Environment: Browser\r\n- Platform: Safari 10.0\r\n- Adapter: WebSQL\r\n- Server: CouchDB 2.0.0\r\n\r\n### Reproduce\r\n\r\n1. Create a local DB in safari, replicate some data into it.  Default adapter (websql) and size: 50.\r\n2. Destroy the local db.\r\n3. Immediately after resolving I recreate the db (with the same name), same as step 1.\r\n4. Refresh the page. If you don't refresh the page and immediately try (5), it will work fine.\r\n5. Try to replicate with the same data from (1). This silently fails and PouchDB keeps polling the remote DB's index endpoint (returning `{\r\ncouchdb: \"Welcome\",\r\nversion: \"2.0.0\",\r\nvendor: {\r\nname: \"The Apache Software Foundation\"\r\n}\r\n}`.\r\n\r\nNote that while I can create new stuff in the local DB, the replication doesn't work.\r\n"},"comment":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/comments/264745481","html_url":"https://github.com/pouchdb/pouchdb/issues/5943#issuecomment-264745481","issue_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/5943","id":264745481,"user":{"login":"aeharding","id":2166114,"avatar_url":"https://avatars.githubusercontent.com/u/2166114?v=3","gravatar_id":"","url":"https://api.github.com/users/aeharding","html_url":"https://github.com/aeharding","followers_url":"https://api.github.com/users/aeharding/followers","following_url":"https://api.github.com/users/aeharding/following{/other_user}","gists_url":"https://api.github.com/users/aeharding/gists{/gist_id}","starred_url":"https://api.github.com/users/aeharding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aeharding/subscriptions","organizations_url":"https://api.github.com/users/aeharding/orgs","repos_url":"https://api.github.com/users/aeharding/repos","events_url":"https://api.github.com/users/aeharding/events{/privacy}","received_events_url":"https://api.github.com/users/aeharding/received_events","type":"User","site_admin":false},"created_at":"2016-12-05T00:47:08Z","updated_at":"2016-12-05T00:47:08Z","body":"@nolanlawson you were on the right track! The issue was the Application Cache fallback in webpack-offline. Because Safari does not support service workers, it falls back to AppCache. This is fine, although I proxy CouchDB under `/db/` and therefore any non `2xx` requests will subsequently be cached and served index.html (I have a fallback in the appcache for my SPA).\r\n\r\nThis is a limitation of the Application Cache, and is yet another reason for browser vendors to hurry up and support Service Workers! :)\r\n\r\nMy fix was simply disabling Application Cache in webpack-offline. Another possible workaround would be to make a separate subdomain for CouchDB, but I'm lazy. :)\r\n\r\nSuper hard to debug, although seems obvious now. :/"}}
{"actor":{"display_login":"aeharding"}}