Firebase functions - deploy doesn't skip functions that haven't changed

990 views
Skip to first unread message

Reynaldo Celaya III

unread,
May 27, 2023, 11:41:22 PM5/27/23
to Firebase Google Group
Hi All.
When deploying all functions I remember seeing that functions were skipped when they didn't change. I no longer see this behavior and all functions are redeployed ever since we changed our script to deploy batches of 9 functions at a time. 

What we were doing before:
firebase deploy --only functions

What we do now(while looping through all functions we batch 9 at a time )
firebase deploy --only functions:FUNCTION1,functions:FUNCTION2  ... functions:FUNCTION9

Nothing has changed with how we build the functions (run typescript TSC, no module bundler )

Any Idea why the deployment is not recognizing that the functions are the same?

Alan Escobar Martinez

unread,
May 31, 2023, 12:19:35 PM5/31/23
to fireba...@googlegroups.com
Hello Reynaldo, 

Maybe there is a confusion here, since the behavior that you are describing is related to Hosting, not to Cloud Functions. For Functions we organize them in groups, and with that we have three different options: 
  1. Deploy all the functions at once.
  2. Deploy all the functions that are related to a particular functionality through groups.
  3. Deploy the functions individually.
Maybe comparing the content of each cloud function to all the images uploaded (a cloud function could be replicated multiple times to accept multiple executions at the same time) makes this more complex than do it in Hosting, but it is worth to add this idea to the Firebase User Voice, maybe the Functions team finds a solution for that. 

Regards

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/d50076c2-e7c2-4467-812f-655f14d64dden%40googlegroups.com.


--
EPAM_LOGO_Full_Color_RGB.png

Alan Escobar Martínez

Technical Solutions Engineer

Service provided by EPAM Systems, on behalf of Google

Reynaldo Celaya III

unread,
Jun 6, 2023, 4:20:31 PM6/6/23
to Firebase Google Group
Hi Alan, this is definitely a feature of Firebase functions that I have seen work in the past. There are bug fixes committed to the firebase-tools repo around this feature:
https://github.com/firebase/firebase-tools/issues/5354
https://github.com/firebase/firebase-tools/pull/5355

Frank van Puffelen

unread,
Jun 9, 2023, 1:12:58 PM6/9/23
to Firebase Google Group
Hey Reynaldo,

The CLI indeed has functionality to skip functions that have not been modified. But (from what I understand from the engineering team) that logic is only run when you tell it to deploy all functions. When you give it instructions to deploy a specific function/set of functions, it assumes that you know best and skips the change detection logic (as there are some valid use-case for that).

   puf

Thomas Bouldin

unread,
Mar 27, 2024, 8:30:11 PM3/27/24
to Firebase Google Group
Late to the group. I just found this thread when looking up references for https://github.com/firebase/firebase-tools/issues/6879

Function deploys are only bypassed if:
1. The entire node module has not changed (otherwise we cannot rule out side effects from utility functions)
2. The value of your environment variables have not changes
3. Your secrets have not been updated

What that means is if you use the technique described in our docs as "Group functions" then all functions will be deployed when you modify any of your source code, but if you organize functions in codebases, then deploys can be bypassed on codebase boundaries.

Reply all
Reply to author
Forward
0 new messages