With this, my expectation is that all files in the VM’s /app/public/ directory is mapped to example.fly.dev/static/. E.g. /app/public/images/faq.svg will be mapped to example.fly.dev/static/images/faq.svg.
However, when I deploy this configuration change with flyctl deploy, the JSON output flyctl config display has no trace of the statics mappings (doesn’t exist at all). Likewise, all the routes (e.g. example.fly.dev/static/images/faq.svg) are simply being directed to the underlying Next.js (Node) server, which gives its 404 error.
Any advise here? My app is being build remotely on Fly.io’s infrastructure using the heroku/buildpacks:20builder.
Hey, Jake! Thanks for flagging this, I’ll have a look. Can you let me know the name of your app, and is it still running? (If it’s not, can you run it? I’ll kick some credits at you so you’re not paying to help us debug.)
We’re talking this through in PMs, but real quick, and not related to the problem you’re having here — pretty sure you caught an API bug too; the static configs aren’t being echoed back in flyctl config display. They’re there! Fixing!
We do a bad job of documenting this (I’m fixing it now) but: we deliberately break symlinks in our cache. If your static directory points to something like /app/public, where /app is, like, a link to /app-2, our static cache thingy won’t serve it; the workarounds are either not to use the symlink in your container, or just to give the absolute real path in the [statics] block.
Everything’s working well for me now – thanks! Our static payloads are taking around 20ms to download now – much better than the 150-200ms it was taking Next.js!