Comments (7)
So I've fixed that in 996176d, but that only prevents new versions from accidentally creating a bogus database. Depending on how widespread this problem is we may have to bump the schema version for IndexedDB and create the stores if they don't exist.
from drift.
Thanks for the report, I'll try to reproduce this with an example from this repository.
However, storage doesn't function as anticipated.
Is it just completely broken without giving any error message or is there more that might be relevant?
In private mode, additional missing features are noted:
Does it also pick sharedIndexedDb
there?
from drift.
it does pick sharedIndexedDb
I believe that it successfully creates the Database (i.e. in my debug panel I can see the expected db got created)
though afterwards, nothing is getting stored. Normally I'd get a dropdown showing at least a little of what got stored,
(as shown on pre-migration)
So I'm making the assumption that nothing is getting stored. My initial (blindly attempting) pull request's goal was to see if perhaps there was an issue with utf-8, as for why we discussed I don't think that's the case.
output from private mode: Using WasmStorageImplementation.sharedIndexedDb due to missing browser features: {MissingBrowserFeature.dedicatedWorkersInSharedWorkers, MissingBrowserFeature.fileSystemAccess, MissingBrowserFeature.sharedArrayBuffers}
Alls to say, my bet would be that there's something fishy with the fileSystemAccess
on Safari if the lack thereof makes the implementation work
from drift.
Update: I think the initial trail might have been a little misleading; there's two new things that might give you clue to what's up.
I've found potential solution for the Safari normal mode issue. This might have been a migration-to-wasm issue, though I was sure to rename the db after migrating. Not completely sure.
However, there's a new twist in Safari's private mode: storage works correctly on the first load, but fails on subsequent reloads. This is a different layer to the problem, suggesting an issue with Safari's handling of data storage and retrieval across different browsing sessions. It doesn't occur on private mode in other browsers.
@simolus3 , If you have a discord, I can PM you a link to the site with the issue. It'll be a black box, but at least you'll be able see what states get you into what
from drift.
Sure, my Discord username is simonbinder
from drift.
I might add some strange things discovered in Safari 17.4.1. It seems like deploying web application with Cross-Origin-Embedder-Policy
header set to require-corp
breaks the WasmDatabase
entirely (Safari only, other browsers have no issues). The application initializes and works perfectly fine with the first run, however on each following page refresh the drift
throws the error in the console, unable to initialize:
Note: I'm building the examples/app
application (cd examples/app && dart run build_runner build && flutter build web
) and then deploying it with the following command:
dhttpd '--headers=Cross-Origin-Embedder-Policy=require-corp;Cross-Origin-Opener-Policy=same-origin' --path build/web/
The drift
picks IndexedDB for storage:
Using WasmStorageImplementation.sharedIndexedDb due to unsupported browser features: {MissingBrowserFeature.dedicatedWorkersInSharedWorkers}
And the culprit seems to be the IndexedDB's database not being populated, as like WasmDatabase
doesn't have the write access (it should contain blocks
, etc):
What's even more strange is the fact that deploying application without the COEP/COOP headers works fine and even deploying the COEP with credentialless
works fine! However, when COEP is set to credentialless
, the drift
seems to consider SharedArrayBuffer
s as being unavailable:
Using WasmStorageImplementation.sharedIndexedDb due to unsupported browser features: {MissingBrowserFeature.dedicatedWorkersInSharedWorkers, MissingBrowserFeature.sharedArrayBuffers}
Yet I can confirm the headers are set:
Perhaps Safari with COEP set to require-corp
needs some additional deployment configuration? I'll try to investigate this a bit and leave a comment, if something is up.
UPD. The bug mentioned at https://drift.simonbinder.eu/web/#additional-headers might be related, however I'm not sure: https://bugs.webkit.org/show_bug.cgi?id=254065. Also it seems to have RESOLVED FIXED
status.
from drift.
Thanks for the report! Did you already have a database from a previous run in the first screenshot? Drift should pick opfsLocks
here, unless it detects that the IndexedDB database already exists (so that no data is lost).
However, when COEP is set to
credentialless
, thedrift
seems to considerSharedArrayBuffer
s as being unavailable:
When I tried that, crossOriginIsolated
also reported false
in the console - so shared buffers really are unavailable.
The problem, I think, comes from here:
drift/drift/lib/src/web/wasm_setup/shared.dart
Lines 116 to 139 in 2d870a6
We're checking whether an IndexedDB database exists because, if it does, we don't want to use OPFS even it is available. The problem is that (despite aborting the transaction) we seem to create the database inadvertently with that check. That's a big problem, because it now means that as soon as we reach a state where OPFS doesn't exist/is unavailable, we'll try to use that broken database.
Most browsers support indexedDb.databases
though, I'll migrate the check to that if it's supported to avoid creating the database here.
from drift.
Related Issues (20)
- Allow QueryInterceptor to ignore/exclude specified tables HOT 1
- Converting database keys in toJson from camelCase to snake_case HOT 1
- LazyDatabase is imposible to execute queries when reopen HOT 1
- flutter web unable to build HOT 1
- No `SqliteException` thrown if when fetching data from non existent column in test mode HOT 4
- Can't compile to wasm HOT 1
- [web] TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm' HOT 1
- SqliteException(1): while preparing a statement, unrecognized token: "@" HOT 3
- Database can no longer be mocked with new manager API HOT 10
- [Documentation] Insufficient documentation and examples on complex migration HOT 1
- Ability to mark foreign key constraint as deferrable HOT 1
- Schema verifier fails in setting DatabaseConfig.doubleQuotedStringLiterals HOT 4
- Flutter not resolving
- database is locked error with WAL journal mode HOT 4
- Option to run a few queries sequentially HOT 3
- Code generation creates database table with wrong type HOT 9
- Drift generator doesn't strip custom row class from SQL HOT 1
- Primary Key not required in companion insert HOT 1
- Issue with generated code: database.g.dart file HOT 22
- Select int64 return type HOT 4
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.