How to deploy functions without going through the build process

Hi,

I wanted to know if it’s possible to deploy already built lambda-functions, without going through the build process for the website.
My website takes quite some time to build, so when I am developing/testing functions, for every new version I want to deploy I need to wait for the website to rebuild, even tho there’s no changes done on the website itself.

1 Like

Hi,

You can deploy your site (including your functions) using the netlify cli. Have you given that a try?

I have the same question. @Dennis you didn’t really answer Jon’s question. Is it possible to deploy ONLY a function and NOT the entire site?

@spencergt, just to clarify, Netlify deploys sites in an atomic way. Basically, it creates new instances of the site and points to the latest instance (deploy) or whichever one you set. Each deploy is a complete site so you can’t update pieces of it (which is probably what you want to do with your function).

That said, I suggested the cli to avoid having to rebuild the site, but you have to still deploy it the existing site (even with no change). Our system will see that there is no change and will not require those files to be re-uploaded. If you omit your site, that will be seen as a change (empty site vs existing site).

In summary, no, you can’t JUST deploy a function to an existing site. But there are ways to avoid rebuilding a site that has not changed. For example, you can use a build plugin (netlify-plugin-cache - npm) that caches your built site and only rebuild if that has changed.

Hopefully that clarifies how deploys are done and provide a way to accomplish your goal.

1 Like

Thanks @Dennis that makes sense. I’ll give that plugin a try, appreciate the clarification.

1 Like