Deploy only functions

Is it possible to only deploy functions using the CLI? Sometimes I don’t want to go through a full website build cycle just to update a function. Google allows something like: google deploy --only functions. Does Netlify support something similar as well?

While it is possible, I think it is not possible in the way you mean:

You can deploy a site that is only functions with no static content.

However, you cannot deploy ONLY the functions for a site that has other content - each deploy must contain all files AND functions the live site should serve.

Our deploys are atomic and we don’t have any plans to change this. Our CLI will not re-UPLOAD your unchanged files, so the deployment process should be pretty quick if you just change functions :slight_smile:

1 Like

Aha I see. Totally clear, thanks!

As one of Netlify’s selling points is the ease of deploying JAM stack shaped sites with static content and APIs for generating them, how are we supposed to utilize these API’s at build-time?

The way it is now, such code would have to hit existing API functions, so if new build-time code is pushed that relies on new API code in the same push, the build will always fail, and the new API will never get updated to fix the failure. I can appreciate that “[your] deploys are atomic and [you] don’t have any plans to change this.”, but is there any way to just run function compilation/deployment first?

I think finer grained sequencing of build operations (or just a pre-build flag) would solve most chicken-egg problems. Additionally there are caching advantages that could be had by using things like on-demand builders that were deployed before the main build script, allowing the the build to essentially warm the cache for any info it needs at build time, which is likely exactly the parts of the cache you want pre-warmed.

I am going to re-frame this as a new question: Any way to call current API functions / On-demand-builders during main build?