Replies: 3 comments 7 replies
-
Sorry, another note, FWIW whether it hangs or not, the browsers I'm using seem to fallback to sharedIndexedDB:
Happens whether it works or not, so maybe not relevant, but thought perhaps the specific storage impl might be worth knowing. |
Beta Was this translation helpful? Give feedback.
-
After further troubleshooting, it seems like I was wrong, it does depend on my build environment. The broken build is done in AWS codepipeline, but if I copy my local sources into the s3 bucket for the deployment, problem seems to be resolved. |
Beta Was this translation helpful? Give feedback.
-
It should print them to the console.
If you're not enabling CORS headers, this is actually expected. Do you see logs about workers not being loaded or something similar that would point towards a possible cause? |
Beta Was this translation helpful? Give feedback.
-
I am running into an issue that seems to be specifically occurring when I am serving a flutter app from S3. I didn't want to file a bug yet since I don't have a minimal repro and am unsure if this is a drift problem or (maybe more likely) has to do with how I have my S3 deployment configured. I will be super grateful for any advice/suggestions anyone has.
I have a flutter app that I build for iOS, Android, and web. It uses drift as a local store. I have:
My web folder has drift_worker.dart 2.10 and sqlite3.wasm 2.1 pulled from the repos linked in the web instructions. (I currently am using the sqlite3.debug.wasm build actually, but I don't know how to get any information from it, not sure if I need to set some flag to get logs or what?)
When I load my app, it initializes the DB, and eventually will perform some requests against it. On native platforms, this works without issue.
On web, if I run locally it works, whether I build in debug or release mode.
When I run on web, specifically when it's being served from an aws cloudfront/s3 deployment, it seems to hang on initialization. Running from a local web build, built release or otherwise, db initialization seems to proceed as expected. The hang happens whichever browser I've tried (from mac chrome/safari or windows edge/firefox), and whether I'm in normal or private mode.
For example, using the code here, on a working (local) run, I can see log lines dropped from the initializeDatabase function, but when I'm loading from a cloudfront/s3 distribution, I do not see the log lines happen.
Basically, any async call, including the database open, seem to never return when served from cf/s3, but work fine from others.
I had seen similar behavior when using older versions of drift, but it seemed to happen really infrequently, and when I used an incognito window or cleared local data, it worked fine. Having upgraded to 2.10 recently, I run into the error 100% of the time when deployed from s3.
It sounds like maybe it's a header configuration issue. I'm not seeing the CORS headers I expect coming from cf/s3, so I will check into that next.
Beta Was this translation helpful? Give feedback.
All reactions