Firebase Functions Deployment and Dependencies Doubt

57 views
Skip to first unread message

JasonHoch

unread,
Apr 25, 2019, 10:15:05 AM4/25/19
to Firebase Google Group
This may sound weird but I would like to clear the doubt.

Let's say for example, I had deployed functionA with package.json(A)

Then later, I had created new file functionB with package.json(B) and deployed functionB. 
*The package.json(B) is totally different than package.json(A).

Question:
Will the functionA use the package.json(B) dependencies and crash?



JasonHoch

unread,
Apr 26, 2019, 10:49:02 AM4/26/19
to Firebase Google Group
I found this description from Google Cloud Functions
 Each Cloud Function runs in its own isolated secure execution context, scales automatically, and has a lifecycle independent from other functions.

Does this mean that each function will have its own package.json and independent from each other functions?
If true, could I run one function with firebas...@7.3.0 while another function with firebas...@6.4.0 at the same project and at the same time?

Michael Bleigh

unread,
Apr 26, 2019, 12:06:45 PM4/26/19
to Firebase Google Group
When deploying functions via the Firebase CLI, by default all of your functions are updated with each deploy. If you've changed the package.json in your functions directory, that means that functionA and functionB would both be updated to use the new dependencies. You can also deploy only a subset of functions:

    firebase deploy --only functions:functionA

It's not clear from your original question what your setup looks like exactly, but only a single package.json (the one in your functions directory) is used. If you have other package.json files in subdirectories those will not be used to populate dependencies when you deploy.

Michael Bleigh

unread,
Apr 26, 2019, 12:15:18 PM4/26/19
to Firebase Google Group
To clarify a bit further, if you deploy only functionA, change the package.json, then deploy only functionB, then yes they would be running with different dependencies. However, if you then deployed functionA again it would pick up the new dependencies from the change.

Cloud Functions dependencies are only updated when they are deployed, which is fully in your control.
Reply all
Reply to author
Forward
0 new messages