打开 indexedDB.open 的后备存储时发生内部错误

Anu*_*rag 5 javascript google-chrome indexeddb dexie

我在公共环境中收到此错误日志,在大约 0.1% 的会话中非常一致。

我正在使用德克西。https://dexie.org/

class DexieDB extends Dexie {
    cacheData!: Table<CacheData>;

    private static instance: DexieDB;
    private constructor() {
        super('DexieDB');

        const store = { ...cacheDataSchema };
        this.version(2).stores(store);
    }

    public static get Instance(): DexieDB {
        if (!this.instance) {
            this.instance = new this();

            // Open the database
**          this.instance.open().catch((e) => {**
                logOpenDBFailed(e);
            });
        }

        return this.instance;
    }
}

export const dexieDB = DexieDB.Instance;

Run Code Online (Sandbox Code Playgroud)

粗体行抛出此异常。我在 Google 搜索上没有找到任何令人满意的重现步骤或此异常的原因。如果有人有任何信息或指示,请告诉我。我不知道如何重现这个问题。提前致谢!

试图找到重现步骤但没有任何运气。根据谷歌搜索,我看到这篇文章https://jasonsavard.com/forum/discussion/4233/unknownerror-internal-error-opening-backing-store-for-indexeddb-open ,但这里提到的原因听起来都不合理在我的场景中。大多数崩溃发生在 Windows 机器上

Dav*_*der 1

在私有模式下运行 Firefox 时,对 Dexie open() 的调用将会失败,因为它不支持私有模式下的 indexedDB。除在私有模式下支持 IndexedDB 之外的所有其他浏览器均将数据视为私有会话的临时数据。难道是这个原因吗?