Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IndexedDB error: A mutation operation was attempted on a database that did not allow mutations

console.log(db); //db object exists
console.log(db.objectStoreNames.contains('test')); //true - object store exists

var transaction = db.transaction(['test'], 'readwrite'); // this line is causing the error

A mutation operation was attempted on a database that did not allow mutations." code: "6

Why am i getting this error? My db and objectstore exists? I'm loosing my mind! :D Any help is much appreciated!

Thanks

like image 431
Johan Avatar asked Dec 31 '25 03:12

Johan


2 Answers

One potential cause of this error: Firefox does not support IndexedDB in private browsing windows. See https://bugzilla.mozilla.org/show_bug.cgi?id=1639542 and https://github.com/jakearchibald/idb/issues/81.

like image 56
Josh Kelley Avatar answered Jan 02 '26 17:01

Josh Kelley


I just try now on chrome, safari on Mac os x and found no error.

I do as follow on http://dev.yathit.com/ydn-db/using/schema.html (the page load ydn.db.Storage object)

schema = {stores: [{name: 'test'}]}
st = new ydn.db.Storage('test1', schema)
// ... wait for async
db = st.db()
db.transaction(['test'], 'readwrite')

old chrome use 1 instead 'readwrite', but i don't think it a reason.

like image 35
Kyaw Tun Avatar answered Jan 02 '26 16:01

Kyaw Tun