Dexie.js: Can't create Dexie database in Safari 11.0.1 (11604.3.5.1.1)

Created on 24 Nov 2017  路  14Comments  路  Source: dfahlander/Dexie.js

The strangest thing is happening. I can't seem to be able to create a database in Safari 11. Below is the code example I'm using:

<!DOCTYPE html>
<html>
<head>
  <title>IndexedDB test</title>
  <script src="https://unpkg.com/[email protected]/dist/dexie.js"></script>

  <script>
    var db = new Dexie('test__' + new Date().getTime());
    db.version(1).stores({ friends: '++id,name,age,isCloseFriend' });

    db.open().catch(function(err) {
      console.error('Failed to open db: ' + (err.stack || err));
    });
  </script>
</head>
<body>
  <h1>IndexedDB test</h1>
</body>
</html>

See Plunker.

Could you guys verify if there's indeed an issue?

Thanks.

A.

Most helpful comment

All 14 comments

Safari requires the page to be served over http /https and not occur within an iframe.

I seeing the same problem on Safari 11.0.1. Also, I can see the db is created and populated with data in both Chrome and FF, but Safari think the db is empty.

@playground If you give an URL where to access the page, we could try find what's the error. Are you serving the page over HTTP / HTTPS or just from the file system?

@dfahlander sure, I uploaded the test page here https://widgets-dev.weather.com/universal/test.html
Yes the page is served via http/https and works in both Chrome and Firefox.

@playground @dfahlander I have also tested the page over http/https. I can confirm the issue is also in Safari 11.0.2 (Beta). I have also tested on Safari 9 and could not reproduce the issue. Something must have been introduced in the last October Safari update. Note, clearing the Safari cache / localStorage / indexeddb and then trying to create an indexeddb via Dexie (or other libraries) does not work either. You have to restart Safari all together - otherwise it won't let you create any databases. Another issue I noticed when testing on Safari 9/11 is that the Dev. Tools report multiple indexeddb databases. I think we could be looking at a more sinister Safari bug with indexeddb.

Thanks @antonioaguilar, is this a known issue for Safari and has the issue been filed?

@playground No - I haven't filed a report. I'm still investigating other issues and want to make sure the bug can be reproduced consistently. Any suggestions on what could be a realistic test for indexeddb?

Other than not able to read/write to IndexedDB, Safari also throws "This page was reloaded because it was using significant memory" error. I have just recently upgraded to High Sierra.

@antonioaguilar I also noticed multiple indexeddb databases with the latest Safari. Any signs of getting these fixed from Safari side?

@playground If you file the issue on https://bugs.webkit.org and then post the link to the issue here, I will support the issue by commenting it asking for any updates.

Just make sure to give intstructions on how to reproduce it.

Looks like the issue is fixed in Safari Version 11.0.3 (13604.5.6), however, I'm still seeing issues on iphone 6 & 8 (both Safari and Chrome browsers) the page will load and then reloaded with error message "the webpage was reloaded a problem occurred". Is anybody seeing this error?

Dexie.exists("some_name").then(e=>{
   if( !e ){
      window.indexedDB.open("some_name", 1);
   }
});
Was this page helpful?
0 / 5 - 0 ratings

Related issues

devolarium picture devolarium  路  3Comments

dmlzj picture dmlzj  路  3Comments

dfahlander picture dfahlander  路  4Comments

asdip138 picture asdip138  路  3Comments

xavibonell picture xavibonell  路  4Comments