How to configure timeout of Firebase functions on local

折月煮酒 提交于 2020-01-13 10:27:17

问题


I want to do some intense job on firebase functions and it usually takes more than 60 seconds. On production, I can set timeout longer from web console but I cannot find setting for local environment.

Following is the command which I'm using to start serving.

firebase serve --only functions

I'm using HTTPS trigger and following is the command to trigger my function on local.

functions-emulator call myfunc --data='{"uid":"user_id_1"}'

Is there way to configure timeout on local?


回答1:


You can set the timeout and memory options in local using the RunWith function

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
});

The maximum value for timeoutSeconds is 540, or 9 minutes. Valid values for memory are:

128MB
256MB
512MB
1GB
2GB




回答2:


You can set the time more than 60 seconds.

Default timeout can be changed here: Console Cloud functions


select function -> name function -> edit -> timeout



来源:https://stackoverflow.com/questions/46005374/how-to-configure-timeout-of-firebase-functions-on-local

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!