-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Safari: Unhandled Promise Rejection: NotFoundError: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found. #134
Comments
I think the function createStore(dbName, storeName) {
const dbp = idbReady().then(() => {
const request = indexedDB.open(dbName);
// Log #1
console.log(request);
request.onupgradeneeded = () => {
// Log #2 is never called
console.log("Create store", request.result);
request.result.createObjectStore(storeName);
};
// Log #3
console.warn("onupgradeneeded?");
return promisifyRequest(request);
});
return (txMode, callback) =>
dbp.then((db) => {
callback(db.transaction(storeName, txMode).objectStore(storeName));
});
} |
Okay, this comment on MDN is interesting: // This handler is called when a new version of the database
// is created, either when one has not been created before
// or when a new version number is submitted by calling
// window.indexedDB.open().
// This handler is only supported in recent browsers.
request.onupgradeneeded = function(event) {
var db = event.target.result;
[…] So… I guess the handler isn’t called because the DB already exists, but apparently not with a store? |
I’m trying to reproduce how I got into this state… For now, I’ve fixed the issue be removing all relevant databases from ~Library/Safari/Databases/… |
It sounds like a database of the same name had already been created on that origin, but without the object store. Does that sound likely/possible? |
Yes, that's what I'm seeing in Dev Tools: multiple keyval-store databases for the same domain. Is that correct or should there only ever be one? |
Only one, unless you've created many |
Issue
How to replicate
macOS 11.6
Safari 15.0
When developing on localhost everything works initially. But once I deploy the code to a different domain, I tend to see this error. I don’t know what the error message is trying to tell me and how I can fix it. I have a feeling that some things are getting mixed up:
My setup:
In the web inspector under application storage, the domain of the host page is shown.
The text was updated successfully, but these errors were encountered: