Michele Volpato

Michele Volpato

The request was aborted because there was no available instance


Some days ago some of the cloud functions I run on a couple of the projects I am working on started to fail with the error: “The request was aborted because there was no available instance”.

This means that Google is not able to run a new instance of your function, for one reason or another. Triggered functions, those created by an event that happened within Firebase are rerun later. Firebase ensures that they are run sooner or later. HTTP functions, instead, are just lost.

If this error appears suddenly, without a recent change in your functions code, or a spiked in your app usage, then the issue is on Google’s side. You can only notify them and wait. In this case, you can increment the number of minimum instances for your HTTP functions, so that they can meet your user demand.

What I did was increase the minInstances as per Firebase documentation. Be aware that this is not a final solution. In my case, the function is called rarely and it is not cost-effective, ~25 euro per month, to get an instance always ready.

You can increase the number of minimum instances by changing the runWith options:

exports.publishImages = functions
        timeoutSeconds: 540,
        memory: '2GB',
        minInstances: 1,
        maxInstances: 2, 
    .https.onRequest(async (request, response)  => {
        // Function

Get a weekly email about Flutter

Subscribe to get a weekly curated list of articles and videos about Flutter and Dart.

    We respect your privacy. Unsubscribe at any time.

    Leave a comment