Search code examples
firebasefluttergoogle-cloud-functionsgoogle-cloud-vision

Image Moderation always times out on Google Firebase cloud functions?


I'm trying to implement an image moderation function on my flutter app, and I'm using this function as a starting point:

Image Moderation on Github

Unfortunately, even though the function detects images that need to be moderated, the ImageMagick blur function always times out.

I've added additional timeout - up to 60 seconds (which seems a very long period for images no bigger than 400x400!) - but to no avail.

Am I missing something? I'm on a Blaze plan, so should have no issue from a capacity perspective, but I just can't seem to get the blurred image out of the function?

EDIT: seems to be the await mkdirp(tempLocalDir); which is causing the problem. From the Github code, everything works up to that point...?


Solution

  • One option would be to not create temp local directories and simply download the file to /tmp and clean up afterwards. Since functions run in isolation, you are not going to encounter name collisions.