8000 Error with Safari 8.0 (OS X 10.10 Yosemite) · Issue #2533 · pouchdb/pouchdb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with Safari 8.0 (OS X 10.10 Yosemite) #2533

Closed
frdmn opened this issue Jul 26, 2014 · 28 comments
Closed

Error with Safari 8.0 (OS X 10.10 Yosemite) #2533

frdmn opened this issue Jul 26, 2014 · 28 comments

Comments

@frdmn
Copy link
frdmn commented Jul 26, 2014

I'm using PouchDB 2.2.3 on Safari 8.0 (Latest beta of OS X 10.10) and I get the following error:

NotFoundError: DOM IDBDatabase Exception 8: An operation failed because the
requested database object could not be found.

Using this code:

pouchdb.get('apiCache', function(err, otherDoc) {
    pouchdb.put({
        apiData: data,
        timestamp: $.now()
    }, 'apiData', otherDoc._rev);
});

Works fine with Firefox 28 and Chrom 36 as well as Safari 7 on OS X 10.7

@nolanlawson
Copy link
Member

@frdmn We have not tested with Safari 8, because none of the PouchDB devs have access to it yet. :( So your feedback is super valuable.

There are two things I'd recommend you to do:

  1. Report the bug to Apple, since they still have a chance to fix it before Safari 8 ships.
  2. Go to pouchtest.com and then post the link to your test report here, so we can see exactly which test fails and how. (You can test local-only with this link if the first test is too slow.)

As for unblocking yourself in your own code, if you absolutely need Safari 8 compatibility, then use WebSQL by default and fall back to IndexedDB instead of the other way around:

var pouch = new PouchDB('foo', {adapter: 'websql'});
if (!pouch.adapter) { // websql not supported
  pouch = new PouchDB('foo', {adapter: 'idb'});
}

@frdmn
Copy link
Author
frdmn commented Jul 26, 2014

@nolanlawson Thanks for the reply!

  1. Will do in a minute
  2. I tried both checks, and both can't pass the first local check:

bildschirmfoto 2014-07-26 um 20 55 31

I don't really depend on Safari 8 compatibility, so it's not that important to fallback to IndexedDB.

@nolanlawson
Copy link
Member

You didn't give a link... :(

@frdmn
Copy link
Author
frdmn commented Jul 26, 2014

The test stuck, and I dont have any link to give :/

@nolanlawson
Copy link
Member

Ah okay, I see that now, you didn't even pass a single test.

Yeah, this seems like a pretty basic bug in IndexedDB if you can't even open a database. The line failing is this one.

When you report to Apple, feel free to link to this GitHub issue. I think it should give them all the info they need.

Thanks!

@frdmn
Copy link
Author
frdmn commented Jul 26, 2014

Done that :)

Let's wait and see if this gets fixed soon.

@jprichardson
Copy link

@nolanlawson will you update http://pouchtest.com with the new 3.0? Thanks =)

@nolanlawson
Copy link
8000
Member

Done. wait about 20 minutes for the EST midnight cron to kick in.

@jprichardson
Copy link

@nolanlawson Thank you! Although, it's still showing 2.2.4... am I doing something incorrectly?

@nolanlawson
Copy link
Member

@jprichardson Not sure why, but the cron didn't run. Running it manually now.

@nolanlawson
Copy link
Member

BTW these tests are not guaranteed to pass at 100%. Notably it seems the Couch is slow to respond, so a lot of the over-the-wire tests fail.

@nolanlawson
Copy link
Member

@jprichardson Oh okay, it's up to date. It's just reporting as 2.2.4-prerelease for some reason.

@shdev
Copy link
shdev commented Sep 1, 2014

With PouchDB 3.0.3 and Safari Version 8.0 (10600.1.8) it don't work because of this issue.

@nolanlawson
Copy link
Member

iOS 8 comes out on Friday. Can anybody see if the tests are passing yet? I'll try to borrow a phone at work if possible.

@nolanlawson
Copy link
Member

I just tested on an iOS 8 device (8.0 12A365) and I see the same requested database object could not be found error. Oof.

@frdmn
Copy link
Author
frdmn commented Sep 16, 2014

@nolanlawson yeah, I can confirm that (12A365) :/

@juice49
Copy link
juice49 commented Sep 17, 2014

I have experienced this too, with Pouch, other IndexedDB wrappers, and raw IndexedDB.

I found Safari does not consistently fire the onupgradeneeded event – where stores should be created. Incrementing the version fixed the issue for me with raw IndexedDB and Treo (haven't tried with Pouch).

I am new to IDB, so not 100% sure what the correct behaviour is, or whether this is the issue, but hopefully this is helpful info.

@nolanlawson
Copy link
Member

You mean instead of opening it with version 1 as we do here, we should open it with version 2? Or do you mean that we should open the IndexedDB, then immediately close it and open it with a new version number?

@juice49
Copy link
juice49 commented Sep 17, 2014

Yes, in my experiments, opening the database with a different version fixes the problem. I have not tried opening and closing different versions.

It is far from a good, consistent solution though. Even after clearing all browser data I need to change the version and reload to get things going.

@nolanlawson
Copy link
Member

I tried to write a short Gist to reproduce the issue, but was unsuccessful. If somebody could help out, that would be great, for two reasons:

  1. Give the WebKit devs something more manageable than the entire PouchDB test suite to run
  2. Give us a way to detect a broken IndexedDB implementation in case we need to fall back to Web SQL on Safari/iOS 8. (I'd really, really like to avoid browser-sniffing.)

I also filed a bug on WebKit.

@nolanlawson
Copy link
Member

I have experienced this too, with Pouch, other IndexedDB wrappers, and raw IndexedDB.

@juice49 Sounds like you've been able to write an isolated test that reproduces this issue. Any chance you could share it? 😺

@juice49
Copy link
juice49 commented Sep 19, 2014

@nolanlawson Sorry I haven't yet replied, should be able to add my test case today or tomorrow.

@nolanlawson
Copy link
Member

@juice49 Thanks! The WebKit devs specifically asked for that, so it would probably help a lot.

Linking this issue to yathit/ydn-db#20, which is another bug that may hit us after this one gets fixed.

@nolanlawson
Copy link
Member

In case anyone's curious about why this is happening, it turns out WebKit's implementation of IndexedDB is no longer the same as Blink's. They removed the LevelDB dependency and used SQLite instead.

@elmerbulthuis
Copy link

I have this problem when I try to use multiple stores in a transaction. When I use only one store, everything seems to be fine.

The following example will produce DOMException 8 if you click the 'two' button in ios8.

<!DOCTYPE html>
<html>

<head>
    <title></title>
    <script>
        function destroy() {
            var req = indexedDB.deleteDatabase('test', 1);
            req. (e) {
                alert('success');

            };

        }

        function test_one() {
            var req = indexedDB.open('test', 1);

            req. (e) {
                var db = e.target.result;
                db.createObjectStore('one', {
                    keyPath: 'key'
                });
            };

            req. (e) {
                var db = e.target.result;
                var tx = db.transaction(['one'], 'readwrite');

                tx. (e) {
                    db.close();
                };

                var req = tx.objectStore('one').put({
                    'key': new Date().valueOf()
                });
                req. (e) {
                    alert('success');
                };

            };

        };

        function test_two() {
            var req = indexedDB.open('test', 1);

            req. (e) {
                var db = e.target.result;
                db.createObjectStore('one', {
                    keyPath: 'key'
                });
                db.createObjectStore('two', {
                    keyPath: 'key'
                });
            };

            req. (e) {
                var db = e.target.result;
                var tx = db.transaction(['one', 'two'], 'readwrite');

                tx. (e) {
                    db.close();
                };

                var req = tx.objectStore('two').put({
                    'key': new Date().valueOf()
                });
                req. (e) {
                    alert('success');
                };

            };

        };
    </script>
</head>

<body>
    <button >destroy</button>
    <button >one</button>
    <button >two</button>
</body>

</html>

:-(

@nolanlawson
Copy link
Member

@elmerbulthuis Awesome. Thanks to you, I have isolated the error and can pass it on to the WebKit devs. Plus, we can implement a workaround in PouchDB to detect the error and fall back to WebSQL. :)

Just go to this site: http://bl.ocks.org/nolanlawson/c83e9039edf2278047e9

@nolanlawson
Copy link
Member

Fixed by 2a2e722. Now we just need to release 3.0.6.

@frdmn
Copy link
Author
frdmn commented Sep 23, 2014

@nolanlawson awesome! 👍

nolanlawson added a commit to nolanlawson/caniuse that referenced this issue Dec 1, 2014
In PouchDB we found Safari 7.1 and 8 to have the same issues cited in the article about iOS 8. For more details:

* pouchdb/pouchdb#2533
* yathit/ydn-db#20
* localForage/localForage#254
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
0