jakearchibald / idb

IndexedDB, but with promises
https://www.npmjs.com/package/idb
ISC License
6.22k stars 348 forks source link

fails silently `openDb` with `keypath` #253

Closed ghost closed 2 years ago

ghost commented 2 years ago

export async function getDb(){
// fails silently
    const db = await openDB("halo", "1", {
        upgrade(db, oldVersion, newVersion, transaction) {
            db.createObjectStore('hello', {
                // The 'id' property of the object will be the key.
                keyPath: 'id',
            });
            db.createObjectStore('store1');
            db.createObjectStore('store2');
            console.log(3333)
        },
    });
    // works
    await openDB('db2', 1, {
        upgrade(db) {
            db.createObjectStore('store1');
            db.createObjectStore('store2');
            console.log(282)
        },
    });
    return db
}
jakearchibald commented 2 years ago

Works fine https://static-misc-3.glitch.me/idb-tests/silent-fail.html

Happy to reopen this if a minimal reproducible example of the bug is provided.