Cloud functions with heavy dependencies

134 views
Skip to first unread message

Lance Jabr

unread,
Apr 9, 2021, 6:50:23 PM4/9/21
to Firebase Google Group
I'm building a web app with Firebase that involves video rendering. I currently have a node.js server running locally that processes rendering requests. I'm considering porting this to a Firebase cloud function, but it has a lot of dependencies like FFmpeg, Cairo, Pango, as well as a bunch of npm modules.

Does it make sense to build a function which installs these dependencies each time it runs? Is that even possible? Or does it make more sense to get a dedicated server on AWS or something so that I can manage the environment with more control?

Advice appreciated!

-Lance

Hiranya Jayathilaka

unread,
Apr 9, 2021, 8:33:07 PM4/9/21
to fireba...@googlegroups.com
You can package all your dependencies and code as a container and deploy it on Cloud Run: https://cloud.google.com/run

That way you still run your code on-demand (paying for exact compute time), but without the overhead of repeatedly installing dependencies.

--
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/531798ce-3db3-4395-b0d9-e0e54eeaa2fcn%40googlegroups.com.


--

Hiranya Jayathilaka | Software Engineer | h...@google.com | 650-203-0128

Lance Jabr

unread,
Apr 10, 2021, 12:03:11 AM4/10/21
to fireba...@googlegroups.com
Thanks so much for the tip! I am new to web development so it means a lot to me.

Can you trigger Cloud Run from Firebase Database events? 

Thanks,
Lance


You received this message because you are subscribed to a topic in the Google Groups "Firebase Google Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/firebase-talk/jFKnlK3OKO4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/CAE6e%2BPgqQdMH2rvpFAppuz4dkmkNXakcRsFAc_WbNfh3XXP_fw%40mail.gmail.com.

Sam Stern

unread,
Apr 10, 2021, 5:02:24 AM4/10/21
to fireba...@googlegroups.com
Hi Lance,

At the moment that's not possible, Cloud Run only has HTTP and PubSub triggers. But we do hope to bring more Firebase events to Cloud Run in the future. 

In the meantime you could maybe use a Cloud Function to catch the Database event and then send a PubSub to trigger Cloud Run. It's a bit convoluted but maybe still better than trying to squeeze heavy dependencies into Functions. 

- Sam

Reply all
Reply to author
Forward
0 new messages