Search code examples
firebase-extensions

To set a minimum/default value for the memory of a firebase extension function


I'm trying to set a default/minimum value for a function resource in my Firebase extension, I do it like this as described here by setting the memory property of the function resources, but when I try to install it, the value of this property is completely ignored: enter image description here And even though I provided 1024 for its value, its default value is 256MB and the minimum value is 128MB (my provided property is not respected neither as default nor minimum memory)

It is causing confusion for users as reported in these issues: https://github.com/pdfplum/pdfplum/issues/14 https://github.com/pdfplum/pdfplum/issues/11

Is there anyway to set the minimum required memory for a function resource of an extension?


Solution

  • When you override memory of a resource the advanced parameters have no effect on that resource. This applies to both hardcoded values (as in your example) or custom parameters: https://github.com/firebase/extensions/blob/c6945fef573c0cb87dbaf64ba2066737cd7c3a1e/storage-resize-images/extension.yaml#L60

    If you want advanced settings to control memory configuration of your functions, then you should remove memory setting completely. Ex: https://github.com/firebase/extensions/blob/c6945fef573c0cb87dbaf64ba2066737cd7c3a1e/firestore-send-email/extension.yaml#L51

    There's currently no way to control the default/minimum value in the options of the advanced params. You either provide your own memory options (see storage-resize-images example linked above) or you use default options of the advanced params.

    There appears to be a little bug though -- when all resources of an extension have their memory manually set, the memory option in advanced settings should not be showing (I'll file a bug for that).