Posts

Showing posts with the label Google Cloud Functions

Console.log On Firebase Cloud Functions Simply Not Logging.

Answer : Ok, the problem ended up being that the function wasn't deploying properly. What had happened was due to some typescript/firebase config issue - the new code was being compiled to a location that wasn't what firebase was looking for. When deployed the code - some old compiled code was still there to be deployed. The moral of the story here is: make sure you delete your dist/build/lib directory before deploying - as that will cause an error if firebase is looking in the wrong place. In case someone wastes as much time as I did. It turned out I was logged into the wrong firebase project ‍♂️. firebase projects:list Your current project will be highlighted in blue with "(current)" beside it. If you need to change project: firebase use insert-project-id-here

Can You Call Out To FFMPEG In A Firebase Cloud Function

Answer : ffmpeg is not preinstalled (pretty much just ImageMagick); to see exactly what's installed check out the Dockerfile here: https://github.com/GoogleCloudPlatform/nodejs-docker/blob/master/runtime-image/Dockerfile. However, you can upload arbitrary binaries when you upload your code using gcloud beta functions deploy because everything in the current directory (except node_modules ) is uploaded. Note: you only have disk write access at /tmp/ . Option 1: use ffmpeg-static npm module ffmpeg-static is an npm module that builds the correct ffmpeg binary based on the current system during npm install . Since Cloud Functions builds your code in the cloud, it'll build the correct ffmpeg binary. https://github.com/eugeneware/ffmpeg-static You can see it in action in the Cloud Functions for Firebase examples repo. const ffmpeg = require('fluent-ffmpeg'); const ffmpeg_static = require('ffmpeg-static'); var cmd = ffmpeg('/tmp/video.avi') ....