Cloud Functions for Firebase killed due to memory limit exceeded

前端 未结 10 1856
天涯浪人
天涯浪人 2021-01-31 01:53

I keep getting a sporadic error from Cloud Functions for Firebase when converting a relatively small image (2mb). When successful, the function only takes about 2000ms or less t

10条回答
  •  青春惊慌失措
    2021-01-31 02:33

    Another option here would be to avoid using .spawn() altogether.

    There is a great image processing package for node called Sharp that uses the low-memory footprint library libvips. You can check out the Cloud Function sample on Github.

    Alternately, there is a Node wrapper for ImageMagick (and GraphicsMagick) called gm. It even supports the -limit option to report your resource limitations to IM.

提交回复
热议问题