Accessing IndexedDB in iOS / iPadOS 14.6

Since updating my iPad to 14.6, I see huge problems opening a connection to the IndexedDB. This can be seen in our hybrid app and in the Safari Browser directly.

When the app starts, it fails connecting to the database. But when I reload the page afterwards, everything works fine.

  • I seem to be having the same/similar issue on iOS safari 15.

Add a Comment

Replies

Hey Apple,

after doing some more testing and investigation, it pretty much looks as if the IndexedDB support is some kind of lazy-loaded module, and the loading is somehow buggy. I now added a line to access window.indexeddb very early in the bootstrapping of the app, so that it is ready when needed by the "real" code afterwards.

Still not perfect, by a workaround solution for the moment.

  • Hello Heiner,

    got the same problem in our cordova application since iOS 14.6 - calling window.indexedDB earlier seems to fix our problem - thanks.

  • Hello Torsten,

    we have the same problem affecting our app on 14.6. indexedDB Promise is not firing any onerror, onsucces, finally or catch.

    what do you mean precisely by calling window.indexedDB earlier ?

  • Same problem. I added a timeout after the call. If no error or success reply after 500ms, then I retry and it always seems to work the second time.

Add a Comment

Hello. Yes, i have this problem in webview too.

Minimal reproduce code

var request = indexedDB.open("MyTestDatabase", 10);
request.onerror = function(event) {
  console.log('error')
};
request.onsuccess = function(event) {
  console.log('succes')
};

result - empty console. Even after 10 seconds

if i add timeout before openDb, like this

const db = window.indexedDB;
setTimeout(() => {
    var request = db.open('MyTestDatabase', 10);
    request.onerror = function(event) {
       console.log('error')
    };
    request.onsuccess = function(event) {
       console.log('success')
    };
}, 1000);

Can see 'success' in dev console

Did someone test this on iOS 14.7? I have the same issue using nuxt.js in Browser. On iPadOS 15, I can not see any problems with that.

Has this been reported to the webkit team?

  • I reported a bug complete with a sysdiagnose file.

  • Do you have a link to that bug?

Add a Comment

It worked for me when I declared the DB when the page loads.

<!DOCTYPE html>
<html>
 <head>
  <meta charset="utf-8" />
  <script type="text/javascript">
     window.indexedDB;
  </script>
  • This worked for me too. It's an improvement over a timeout and retry of the indexedDB.open() call, which was my existing working around, but I still have the timeout and retry just in case.

Add a Comment