Cloud Functions for Firebase: completing long processes without touching maximum timeout

前端 未结 2 1013
眼角桃花
眼角桃花 2020-12-15 09:12

I have to transcode videos from webm to mp4 when they\'re uploaded to firebase storage. I have a code demo here that works, but if the uploaded video is too large, firebase

相关标签:
2条回答
  • 2020-12-15 09:49

    Cloud Functions for Firebase is not well suited (and not supported) for long-running tasks that can go beyond the maximum timeout. Your only real chance at using only Cloud Functions to perform very heavy compute operations is to find a way to split up the work into multiple function invocations, then join the results of all that work into a final product. For something like video transcoding, that sounds like a very difficult task.

    Instead, consider using a function to trigger a long-running task in App Engine or Compute Engine.

    0 讨论(0)
  • 2020-12-15 10:02

    As follow up for the random anonymous person who tries to figure out how to get past transcoding videos or some other long processes, here's a version of the same code example I gave that instead sends a http request to a google app engine process which transcodes the file. No documentation for it as of right now, but looking at Firebase/functions/index.js code and the app.js code may help you with your issue.

    https://github.com/Scew5145/GCSConvertDemo

    Good luck.

    0 讨论(0)
提交回复
热议问题