I am getting an error with firebase functions. When I run the functions locally using emulators they work fine. But when I firebase deploy
and on subsequent execution of a certain function, I get an error which suggests that the version of ffmpeg installed on the server I have deployed to is out of date
How do I update ffmpeg
(or indeed any software) on the server? Maybe I SSH into it and update software? Maybe I should provide some config to define what software my code depends on prior to deployment? Please advise how an update can be done thanks
OPTIONAL READING:
My Node.js code uses execSync(myFfmpegCommand)
which is why the dependency exists
CodePudding user response:
Here's my findings.
You cannot install custom software onto a Node.js runtime environment as the disk is read only. If the software you want is not on the runtime environment already then you are stuffed.
I further found that functions are not meant for heavyweight work but just for lightweight ops. If a function needs to do some heavy lifting then it can ask Google App Engine to do it for it. The function communicates with App Engine over HTTP or PubSub.
What is App Engine I hear you ask! It basically allows you to deploy server code to the cloud. For example, think of an express.js server that you typically use for your backend. That's what App Engine is. Then you just deploy it!
App Engine can be configured through a yaml file to determine memory and optionally a Dockerfile to determine what OS to use and what software to install. The yaml looks like this:
runtime: custom # uses Dockerfile
env: flex
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 0.5
disk_size_gb: 10
Consider App Engine as the heavy lifter. When a firebase function wants to do some hard work, it just asks App Engine to do it for it! In this manner, firebase functions become simple event handlers to trigger other work.