-
Notifications
You must be signed in to change notification settings - Fork 386
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
Drift not working on Web #2745
Comments
Does the example app work on the web for you? Does drift work without trying to use a pre-populated database or is that broken too? Are there any logs in the browser console? I think I need to see some code or more details on what you're doing to fix this. |
Hello, example app works on web (ubuntu + brave browser ) just fine. Is there a planned web-assembly support ? Due to dart:html usage in drift (probably in sqlite3) and filepicker dependencies used, I can't get it to compile with Thanks for this great library @simolus3 . Insane work, I wish I could help somehow |
Yeah, I'm currently using Given that sqlite3 is also using wasm, hopefully we can eventually just link sqlite and your Flutter application into the same web assembly module. But I don't think the platform can do these things yet, so it might be a little early for drift to start migrating. |
Thank you @simolus3 for the detailed answer. I am planning to use drift for my next big project and it is great to hear that there will be full wasm support once things get mature on flutter side. |
any news on the problem ? @panalgin was your test local or in a real website ? I am also facing error to use on the web, even with the example app.... it works when I run it from vscode, but when I build it with "flutter build web", and push it to my website it doesnt work. tested with chrome 120.0.6099.217, edge 120.0.2210.133 and fireforx 121.0.1 chrome and edge throws same error: Using WasmStorageImplementation.sharedIndexedDb due to unsupported browser features: {MissingBrowserFeature.dedicatedWorkersInSharedWorkers, MissingBrowserFeature.sharedArrayBuffers} TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'. firefox throws: Using WasmStorageImplementation.opfsShared due to unsupported browser features: {MissingBrowserFeature.sharedArrayBuffers} main.dart.js:28768:78 |
Which web server are you using? It needs to recognize |
using apache, thanks. resolved by adding all headers and clearing cache. I was fooled by the table, where it says full support without headers. Below are the headers I added to my .htacess file to make it work if anyone need it. btw @simolus3 when I posted the comment, I looked for solved problems closed to the web, and I found many, some repeated several times. I know there is a manual, but I got lost there myself. Maybe you could do step-by-step testing of the known issues and how to resolve them.
|
Good point, I'll change the documentation to highlight that better. |
Would someone care to share how they were able to enable Content-Type: application/wasm when serving their web app? I've tried these instructions I found: https://docs.flutter.dev/platform-integration/web/wasm but when I run the following command I error "Not Found" dhttpd '--headers=Cross-Origin-Embedder-Policy=credentialless;Cross-Origin-Opener-Policy=same-origin' At I've also tried But this didn't find the web server at all. Thanks in advance. PS: Machine Info. I've also tested on Safari, FireFox, Chrome. None of these work for me. I get the following error. However when running the example app it works fine. Thanks in advance again. |
I went to
That worked (well I've only tested Firefox but the headers are there). I've actually had to run
Also with the |
@simolus3 I was missing the |
Can't seem to get it working on web(Works fine for native platform). Went through all the docs properly. I have a pre - populated .db file which I want to use for web. But can't seem to get any entry or any query executed.
The text was updated successfully, but these errors were encountered: