IndexDB Uncaught Failed to execute ‘transaction’ on ‘IDBDatabase’

I'm working in a login/sigup sistem, I have to take the value of some inputs to register them, but I have a problem.

The error is: Uncaught DOMException: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.

And occur in this code line: "var data = active.transaction(["usuarios"], "readwrite");"

Can anyone help me with this? Here is my code:

var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
var dataBase = null;

function startDB(){

  dataBase ="objectDb", 1);

  dataBase.onupgradeneeded = function (e) {

    var active = dataBase.result;

    var objectDb = active.createObjectStore("usuarios", {keyPath: 'id', autoIncrement : true });

    objectDb.createIndex('index_nombre','nombre', {unique : false});
    objectDb.createIndex('index_user','usuario', {unique : true});
    objectDb.createIndex('index_correo','email', {unique : true});
    objectDb.createIndex('index_pass','pass', {unique : false});

  dataBase.onsuccess = function (e) {
    alert("Base de datos cargada correctamente");


  dataBase.onerror = function (e) {
    alert("Error cargando la base de datos");

function add() {
  var active = dataBase.result;

  var data = active.transaction(["usuarios"], "readwrite");

  var objectDb = data.objectStore("usuarios");

  var request = objectDb.put({
    nombre: document.querySelector("#nombre").value,
    usuario: document.querySelector("#usuario").value,
    email: document.querySelector("#email").value,
    pass: documento.querySelector("#pass").value,

  request.onerror = function (e) {
    alert( + '\n\n' + request.error.message);

  data.oncomplete = function (e) {
    document.querySelector("#nombre").value = "";
    document.querySelector("#usuario").value = "";
    document.querySelector("#email").value = "";
    document.querySelector("#pass").value = "";
    alert("Objeto agregado correctamente");

This is my first project with indexedDB so I'm very noob. Sorry if this is

Read more here:

Content Attribution

This content was originally published by Andree Amaro González at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: