First, my workflow: I use VSCodium on an Intel Mac to edit code in a folder that is shared with a vagrant VM running Debian using VirtualBox services. The folder is mounted using vboxsf in the vagrant VM with working symlinks. (Ask me how!!) Elixir and Phoenix code is running in the vagrant VM.
So, the problem:
When I create the same project on the vboxsf mounted directory structure, no static content is served. Chrome’s developer console warns me “Failed to load resource: net::ERR_CONTENT_LENGTH_MISMATCH” for app.css, app.js, and phoenix.png and they don’t load which makes developing LiveView not much fun. Interestingly, LiveDashboard with its inlined resources works fine.
When I create a new Phoenix 1.6.2 project in the vagrant VM’s own directory structure, the project serves static content (CSS, JS, pngs etc) correctly.
This particular problem didn’t occur when I was using Phoenix 1.5.x - although lots of other problems with npm installation errors did and I had a set of work-arounds for that. So glad to have esbuild now!
Any tips to diagnose what is going wrong? (I’m pretty sure it’s a VirtualBox problem, not actually Phoenix, but my Phoenix dev workflow is repeatably not working the way it should, so that’s where I’d like to start)
I moved Plug.Telemetry to above Plug.Static and I see 200 ok messages for the static content. Can I instrument Cowboy? How? I’m open to any ideas to save my workflow…
Thanks!
[Edit: a little progress]
After modifying the Plug.Static config in endpoint.ex to have an absolute path to a copy of the private/static directory that I placed within /tmp, Plug.Static started serving the content. It’s definitely being caused by something in the vboxsf filesystem, but what? Plug.Static thinks it’s successfully serving the content on a vboxsf filesystem, but wget says zero bytes are received.