19

This is the first time for me to use indexDB, I've created a database and now trying to add content to it. But I'm getting the following error.

Uncaught NotFoundError: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.

I've uploaded my code on jsfiddle just because its easier to show you it running. Any suggestions please ?

https://jsfiddle.net/8kj43kyn/

// Creating an indexDB - Used to store users information.  
window.indexedDB = window.indexedDB || window.mozIndexedDB || 
window.webkitIndexedDB || window.msIndexedDB;
Saeed
  • 5,413
  • 3
  • 26
  • 40
Ryan
  • 271
  • 2
  • 3
  • 7

1 Answers1

16

Should that

var transaction = db.transaction( ["books", 'readwrite']);

be

var transaction = db.transaction(["books"], 'readwrite');
Kyaw Tun
  • 12,447
  • 10
  • 56
  • 83
  • Note that once you've made this change and in order to re-test, you need to open a new tab on your browser. It's not enough to simply refresh. No idea why – Hugo Nava Kopp Nov 19 '20 at 16:46