Ah. The secrets Fly provides are only available to your app at run-time. For example process.env.SECRET (in the case of Node). Not at build time, which looks to be the issue you are having.
I’d recommend scrolling down this thread. It seems to be very similar, where they need the DATABASE_URL during the build part: