admin管理员组文章数量:1181432
For firebase triggered functions (for instance @on_document_created), how do I specify the memory assigned to single functions?
The firebase.json file does not change a thing, all functions are at 256 mb.
{
"functions": [
{
...
"memory": "1GB",
"timeoutSeconds": 300,
...
What changes the memory of the single functions is changing it inside the cloud console, which is laborious.
Is there any way defining it inside the trigger for instance so that I do not have to redeploy it for memory adjustment after I changed the code?
For firebase triggered functions (for instance @on_document_created), how do I specify the memory assigned to single functions?
The firebase.json file does not change a thing, all functions are at 256 mb.
{
"functions": [
{
...
"memory": "1GB",
"timeoutSeconds": 300,
...
What changes the memory of the single functions is changing it inside the cloud console, which is laborious.
Is there any way defining it inside the trigger for instance so that I do not have to redeploy it for memory adjustment after I changed the code?
Share Improve this question edited 2 days ago Doug Stevenson 317k36 gold badges453 silver badges472 bronze badges Recognized by Google Cloud Collective asked 2 days ago Raul PonzheimerRaul Ponzheimer 156 bronze badges2 Answers
Reset to default 1This is covered in the documentation, which suggests that you can provide the required memory in your source code:
In some cases, your functions may have special requirements for a long timeout value or a large allocation of memory. You can set these values either in the Google Cloud console or in the function source code (Firebase only).
To set memory allocation and timeout in functions source code, use the global options for memory and timeout seconds to customize the virtual machine running your functions.
The example provided is for Cloud Storage, but the options are the same for other types of triggers, including Firestore.
@firestore_fn.on_document_created(
"my-collection/{docId}",
memory=options.MemoryOption.GB_1
)
You can see all the options in the API documentation for firebase_functions.firestore_fn. on_document_created accepts FirestoreOptions which includes MemoryOption values.
This did the trick:
@on_document_created(document="collection/{documentId}", memory=512)
本文标签: pythonDefining memory for single firebase functionsStack Overflow
版权声明:本文标题:python - Defining memory for single firebase functions - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738248807a2071262.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论