I am working on a website that will take user data from the form and show it in the table below. I am using indexedDB and everything works locally on my laptop, but when I deploy it to GitHub pages, I get this error: NotFoundError: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.
let db;
let request = window.indexedDB.open("newDatabase", 1);
request.onupgradeneeded = function (event) {var db = event.target.result;
var objectStore = db.createObjectStore("client", {autoIncrement: true,});
objectStore.createIndex("name", "name", { unique: false });
objectStore.createIndex("lastName", "lastName", { unique: false });
objectStore.createIndex("email", "email", { unique: true });
objectStore.createIndex("ID", "ID", { unique: true });
objectStore.createIndex("postal", "postal", { unique: false });
objectStore.createIndex("phoneNumber", "phoneNumber", { unique: true });
var formElements = document.getElementById("form");
var request = db
.transaction(["client"], 'readwrite')
.objectStore("client")
.add({
name: formElements[0].value,
lastName: formElements[1].value,
email: formElements[2].value,
postal: formElements[3].value,
ID: formElements[4].value,
phoneNumber: formElements[5].value,
});
I read on the internet that it may happen when the name of an objectStore is different from the name in the transaction, but it is not the case here, they are both the same. I tried changing them to other names, but the issue was still there...
db.createObjectStore("client", {autoIncrement: true,});
.
.
.
var request = db
.transaction(["client"], 'readwrite')
client
object store. If I run:let request = window.indexedDB.open("newDatabase", 1);
again, but with different name, would that create a new database, but this time with clients ? Here is my problem, for some reason my code sometimes createsclient
object store and sometimes it doesn't... apparently it doesn't do it on github pages – Ferland