I haven't been able to find anything on this, but it seems like it must exist as having to configure this via console isn't great.
I want to configure the appropriate memory allocation per function that is provisioned to Google Cloud Functions. I know it can be changed from defaults via two methods:
On the Cloud Function webpage for the given function, after the function has been deployed.
During command-line deployment if you use gcloud functions deploy
but seemingly not if you use firebase deploy
, such as...
gcloud functions deploy myFunc --memory=128MB
But it seems like there should be a way to provision this via a JSON configuration along side the code itself, or something similar. Does anyone know if this is possible?
The closest that exists is what the commenter mentions above, which would look something like this...
exports.myFunction = onTrigger(
{
minInstances: 5,
maxInstances: 10,
timeoutSeconds: 180,
memory: "512MB",
cpu: 2
},
(event) => {
// cloud function body
}
);
See reference page starting at this section:
https://firebase.google.com/docs/functions/manage-functions?gen=2nd#min-max-instances