Cloud Functions for Firebase killed due to memory limit exceeded

前端 未结 10 1757
天涯浪人
天涯浪人 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:50

    you can add the configurations in your firebase functions definitions something like:

    functions.runWith({memory: '2GB', timeoutSeconds: '360'})
    
    0 讨论(0)
  • 2021-01-31 02:54

    Update: It looks that they now preserve settings on re-deploy so you can safely change memory allocation in cloud console!

    0 讨论(0)
  • 2021-01-31 02:56

    [update] As one commenter suggested, this should no longer be an issue, as firebase functions now maintain their settings on re-deploy. Thanks firebase!

    Turns out, and this is not obvious or documented, you can increase the memory allocation to your functions in the Google Functions Console. You can also increase the timeout for long-running functions. It solved the problem with memory overload and everything is working great now.

    Edit: Note that Firebase will reset your default values on deploy, so you should remember to login to the console and update them right away. I am still looking around for a way to update these settings via CLI, will update when I find it.

    0 讨论(0)
  • 2021-01-31 02:57

    Figuring out from UI is a bit tricky so here are some guided screenshots:
    Go to url https://console.cloud.google.com/functions/list


    You can also increase default timeout of 60 sec

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