Set timeout for Cloud Functions for Firebase does not persist in the Console; is this a bug?

前端 未结 4 1480
傲寒
傲寒 2020-12-08 06:59

Update: I updated the question, to reflect what I described in the body of the question, and what was happening at the time. It also justifies why I did not mark

相关标签:
4条回答
  • 2020-12-08 07:28

    Starting functions v2.0.0 you can also set the timeout in your function declaration as described in the doc under the "Set timeout and memory allocation" section:

    const runtimeOpts = {
      timeoutSeconds: 300,
      memory: '1GB'
    }
    
    exports.myStorageFunction = functions
      .runWith(runtimeOpts)
      .storage
      .object()
      .onFinalize((object) = > {
        // do some complicated things that take a lot of memory and time
      });
    

    As release notes also highlighted:

    You will need firebase-tools >=v4.0.0.

    And on Mac you can get the latest firebase-tools with the following command:

    npm install -g firebase-tools
    

    Also note the limitations and valid values as per the doc link above:

    The maximum value for timeoutSeconds is 540, or 9 minutes. 
    Valid values for memory are:
    
    128MB
    256MB
    512MB
    1GB
    2GB
    
    0 讨论(0)
  • 2020-12-08 07:31

    Per @MichaelBleigh's comment. This has been resolved in the latest version of the Firebase CLI (3.7.0 at the time of this post).

    If you are still experiencing this issue, make sure you are using the latest version of the Firebase CLI.

    0 讨论(0)
  • 2020-12-08 07:36

    Default timeout can be changed here https://console.cloud.google.com/functions/list
    select function >test function > edit > timeout

    0 讨论(0)
  • 2020-12-08 07:47

    After you select your function and then press "Edit" it is located under the "More" drop-down at the bottom of the page. The current max is 540 seconds.

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