Any way to call current API functions / On-demand-builders during main build?

Does Netlify, or can Netlify support building functions (including on-demand builders) prior to running the main build command? Specifically I want to be able to call these functions from within the build, preferably in the same context they will deploy in. to help things like cache warming.

Currently, (AFAIK) build code that would utilize our API would always be talking to the current deploy, which is necessarily some previous build. Usually this isn’t a problem, but it’s certainly possible to naively push both new API changes and build code that relies on them, which means neither will build successfully. (at least this failure is idempotent :stuck_out_tongue: )

A quick and dirty solution is to allow manually building and deploying just the functions, or to replicate the process via manual local build and pushing zip files, but that’s not ideal.

Another work-around is to host the API on a different instance, which has additional benefits but is a bit more to worry about.

But I think the simplest way to do it is just allow some functions to specify a prebuid flag, or similar lifecycle options.

@refactorized As per your known work-around of hosting the functions on a separate instance, you could also host serverless functions elsewhere (AWS, Google Cloud etc).

Perform their deployment as part of the build and await on their completion before moving on to the next phase which calls them.

The obvious down side there being that it’s not an “all-in-one solution provided by Netlify” and you’re now managing “something else”.