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
Failed to execute 'objectStore' on 'IDBTransaction': The transaction has finished #1564
Comments
This happens when you execute a transaction and await non-Dexie calls within it. await db.transaction('rw', db.myTable, async () => {
await fetch('https://xyz.org/...'); // Here's a problem: awaiting non-dexie call within a transaction
return await this.table.update(id, { examineDate: data.examineDate });
}); This is also described here If your function is not executing within a transaction, the case can also be that your caller has the transaction block and calls your function within it after doing the non-dexie work. Let me know if that was the case and what version of dexie you are using. |
alright, I installed latest version dexie in my project
haven't transaction around of them. I ever tried to write the transaction around of this codes, but didn't work |
Are you using a very old browser or Internet Explorer, Legacy Edge or very old version of some other browser? |
These type of problems occur on very old browsers - but also when using IndexedDBShim or possibly also fakeIndexedDB instead of using the native IndexedDB in the browser. One workaround is to transpile the application code to <= ES2016 to get rid of the ES2017 async/await keywords which in those environments are incompatible with IndexedDB transactions. |
I using the latest version electron, it included chromium version about 100.x, so I don't think about it's reason for browser's version. My frontend platform using vue3+vite,it would translate the typescript code to es2015 and support async/await better, I also not doubt the trouble is from code's version |
btw, did you have obstacle for my english? my grammar was too terrible😂 |
Check if IndexedDBShim is included. Try remove it. If you'd still need IndexedDBShim, make sure to transpile the code to ES2016 or ES2015. No problem with your English :) |
Ok, I will try it later and give the feedback to you when it still don't work |
I had a similar problem, Sentry sounds the alarm: my environment: Electron Version:13.1.7. help me please,it's very urgent, thx |
@licao404 我按大佬的方法试了还是没啥用,现在已经转sqlite了,因为项目比较急,没时间研究,所以兄弟你要不要也先用sqlite试试,这个库好像在electron下有点纠结😂 |
@delayhsiao 好像也不是这个库独有的问题,这个库你用的是哪个版本,我看其他indexdb库下也有类似的issues,评论基本上说是浏览器内核的bug。难搞啊 |
我用的最新版,反正大家都在吹indexeddb,但是我发现这玩意儿就跟h5早期状态一样,各家都有不同的支持状态。所以我现在转了sqlite3,用得很流畅,性能什么的,反正单机给个loading让它转就完事儿了 |
I don't know if it's similar to these issues : |
Can you confirm whether IndexedDBShim is being used or not? If IndexedDBShim is used, you must either avoid using async/await or transpile your code to ES2016 (or ES2015 or ES5) in order to avoid native async/await as it will not work with IndexedDBShim. In order to use Dexie in node (Electron main process is a node process), IndexedDBShim can be used as an adapter between the IndexedDB API and SQLite, but IndexedDBShim has the same issues as browsers used to have historically - it won't keep transactions alive between micro ticks. |
same problem and no solution 😢 |
Using the put method and abandoning the update method can solve the problem. Currently I am using this solution |
@superocky & @ArcherGu Are you in a browser platform, Electron or is this happening in node based unit tests (using IndexedDBShim or fakeIndexedDB to run tests in node)? What's your user agent & version? It would also help if someone could create a repro of this problem or else pin point the platforms where this happens. |
some problem |
code: 11
message: "Failed to execute 'objectStore' on 'IDBTransaction': The transaction has finished."
name: "InvalidStateError"
my code is simple:
return await this.table.update(id, { examineDate: data.examineDate })
but,it return error notice like that ↑,I found so many answers from google and github and stackoverflow but no one useful
help me please,it's very urgent, thx
@dfahlander 🙏
The text was updated successfully, but these errors were encountered: