Closed Mike-FR closed 3 months ago
To add more informations while debugging (I am working with @Mike-FR )
The code that emit exception start here: https://github.com/pubkey/rxdb/blob/master/src/rx-database.ts#L351
The bulkWrite funciton is called first time with internal-add-storage-token
and second time with rx-database-add-collection
that is the one we are interested in.
The devMode is True.
The scopeFuncIsAsync is True.
The transaction code run without issue but when it try to commit it directly send to: https://github.com/dexie/Dexie.js/blob/a5519e58e407c518cb47c10673fc8c2fe585a389/src/classes/dexie/transaction-helpers.ts#L99
So IMO there is something between https://github.com/pubkey/rxdb/blob/master/src/plugins/storage-dexie/rx-storage-instance-dexie.ts#L148 and https://github.com/pubkey/rxdb/blob/master/src/plugins/storage-dexie/rx-storage-instance-dexie.ts#L202
that do not respect Dexie rule: https://dexie.org/docs/DexieErrors/Dexie.PrematureCommitError.html
By looking more the issue probably come from incrementExpectedAwaits or decrementExpectedAwaits. https://github.com/dexie/Dexie.js/blob/master/src/helpers/promise.js#L597 https://github.com/dexie/Dexie.js/blob/master/src/helpers/promise.js#L607
Meaning that we may have some other dependecy changing the default behavior of async/await. We will try to go with an empty vue/vite project. Then if not working an empty vanilla project.
I identified that the problem comes from the zone.js
package and in our case it is itself installed by @opentelemetry/context-zone
itself installed by @grafana/faro-web-tracing
that we use in our Vue frontend.
Look like: https://github.com/pubkey/rxdb/issues/6011
Is that mean we need to wait for faro to update dependencies of zone js ?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon. Please update it or it may be closed to keep our repository organized. The best way is to add some more information or make a pull request with a test case. Also you might get help in fixing it at the RxDB Community Chat If you know you will continue working on this, just write any message to the issue (like "ping") to remove the stale tag.
ping
This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon. Please update it or it may be closed to keep our repository organized. The best way is to add some more information or make a pull request with a test case. Also you might get help in fixing it at the RxDB Community Chat If you know you will continue working on this, just write any message to the issue (like "ping") to remove the stale tag.
Issues are autoclosed after some time. If you still have a problem, make a PR with a test case or to prove that you have tried to fix the problem.
Hello,
I was using rxdb 14 on a Vue 2.7 project without problems. I updated rxdb to version 15 and since then I'm facing a PrematureCommitError" error when doing addCollections(). I tried several things without success so I redid a basic implementation on an internal test repository which runs on Vue 3. Same error. Here is the code on my test repo.
my package.json if it helps
The error inside the console that appears immediately
The IndexexDB look likes
Do you see an implementation error? Thanks for your help.