Comments (4)
No idea on what could have caused this yet. Docs say that NoModificationAllowedError
may be thrown by the browser then accessing the same OPFS file multiple times. Can you check whether there's anything in your app that may cause two different database instances to be around without first closing the first one?
If opening the same database two times at the same time is indeed the problem here, deleting databases won't fix this. One way to delete all files for a website is to go to about:settings
, then "Privacy & Security", then "Manage data..." under "Cookies and Website Data". You can entirely clear all content Firefox has set for a given domain there.
Deleting OPFS files is tricky since they're not listed in Firefox Devtools, but I think pasting this snippet to the console should work if no database instance is currently open:
(async () => {
let opfsRoot = await navigator.storage.getDirectory();
let deleted = 0;
for await (const [key, value] of opfsRoot.entries()) {
await opfsRoot.removeEntry(key, { recursive: true });
deleted++;
}
console.log(`Done, deleted ${deleted} entries!`);
})()
from drift.
Thanks for the quick answer!
If i run the script in Firefox i receive:
Promise { <state>: "pending" } <state>: "rejected" <reason>: DOMException: No modification allowed code: 7 columnNumber: 0 data: null filename: "" lineNumber: 0 message: "No modification allowed" name: "NoModificationAllowedError" result: 2152923143 stack: "" <prototype>: DOMExceptionPrototype { name: Getter, message: Getter, INDEX_SIZE_ERR: 1, … } <prototype>: Promise.prototype { … }
When i run in in another Browser it deletes the db as expected and after a reload the db is recreated and works as expected.
Firefox runs with WasmStorageImplementation.opfsShared and my other Browsers with WasmStorageImplementation.opfsLocks. On another machine the App works fine in Firefox.
from drift.
If the No modification allowed
exception happens, your database is currently open somewhere. You could try serving a version of your app once where you never open the database just to check and delete OPFS files, but the problem will likely come back afterwards.
With opfsLocks
, each tab uses its own database instance and briefly opens the file only when it needs to read or write it. opsShared
is a more efficient mode where we use a shared worker that keeps the database files open all the time and serves requests coming in from all tabs. Since a shared worker is used, it should be impossible to reach that state.
To help me debug this, could you look at about:debugging#workers
and see if there are multiple shared workers for your application active? You mentioned that you don't have a way to reproduce this, does the problem not go away after closing your app and re-opening it? Or after deleting data for your app in Firefox settings?
from drift.
I managed to delete the db with the script before the app opens the db.
After a reload i noticed, that the app now runs with WasmStorageImplementation.sharedIndexedDb and i receive:
NotFoundError: IDBDatabase.transaction: 'files' is not a known object store name
error.
Im stuck in this state until i delte the indexed db via dev tools and reload.
After reload im in WasmStorageImplementation.opfsShared mode again and everything works as expected!
The app now works fine from the affected browser. unfortunately I don't know how to reproduce the initial problem. When I had the initial problem, neither reloading nor restarting the browser helped.
If i have an open tab with the app the abount:debugging#workers shows this:
If i close the tab the three entries disappear.
from drift.
Related Issues (20)
- Schema migration helper fails when there are no migrations yet HOT 1
- Views code generation HOT 9
- Cannot test migrations using modular approach with store_date_time_values_as_text: true HOT 4
- Unable to override `runs_before` in `build.yaml` due to `Unrecognized keys` exception HOT 2
- Support remote SQLite databases HOT 8
- drift_flutter package doesn't exist HOT 3
- WEB build db queries returns nothing from a prefilled db HOT 5
- Migration Error when altered same table twice. HOT 1
- Missing `extensions` Import in Generated Code HOT 1
- Add Code Generation for json_serializable HOT 2
- android::register_android_database_SQLiteConnection Android Crash HOT 2
- insertOnConflictUpdate behaves as an insert HOT 8
- Adding unique key that is case-insensitive HOT 1
- `pragma legacy_alter_table = 1` not supported in Turso HOT 4
- [WEB] Can't run a transaction inside `exclusively` HOT 1
- v2.19.0 introduced a breaking change HOT 3
- 404 link in QueryExecutor class documentation HOT 1
- Renew DriftDatabase usage example HOT 1
- feat: Declare column on table with `late final`
- Unhandled Exception: Bad state: Tried to send Request ... over isolate channel, but the connection was closed! HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from drift.