title: "The request was aborted because there was no available instance" - Google Cloud Functions (PubSub trigger)
body: <p>Hey there Overflowers!</p>
  <p>I'm working on a small app that triggers a Cloud Function every time a message is published to a PubSub topic. The code inside the function is working (apparentely) fine, but I'm experimenting some issues with the publishing process.</p>
  <p>For some reason, when posting messages a warning log from the Cloud Function returns: <em><strong>&quot;POST 429 [...] The request was aborted because there was no available instance&quot;</strong></em>.</p>
  <p>I wonder to know what it means and how to deal with it, if anyone could help. I'm not sure how this can be solved from my code.</p>
  <p>Thanks everyone!</p>
  <p><strong>Edit</strong>: The function memory is limited to 256MB, with a 60 secs timeout.</p>
  <p><strong>Edit 2</strong>: I've tested removing instances limitations but the service keeps failing (returning a POST 500 or a POST 429 errors).</p>
  <p>I have another question, my Cloud Functions are returning a timeout sometimes. I'm pretty sure the origin of the problem is in PubSub, the one metioned before, and these CF corresponds to the failing POST requests. In the majority of the cases the functions are executed properly and inside the time range.</p>
  <p>My questions: Why these functions are being executed if the message wasn't posted properly at first (maybe it is retried?) and, more important, why these functions are reaching their timeout limit (they shouldn't trigger until a message is published properly, right)?</p>
  <p><strong>Edit 3</strong>: I've been reading the Google Cloud Functions documentation and I've found my problem already documented here: <a href="https://cloud.google.com/functions/docs/troubleshooting#scalability" rel="nofollow noreferrer">https://cloud.google.com/functions/docs/troubleshooting#scalability</a></p>
  <p>As Guillaume said (thanks again!) it seems to be a scaling issue. The functions are being triggered so fast that they have no enough time to scale instances. I'm gonna try handling the flow of the incoming messages to be slower while ramping.</p>
  <p>The notes from this section could help too:
  <a href="https://cloud.google.com/functions/docs/concepts/exec#auto-scaling_and_concurrency" rel="nofollow noreferrer">https://cloud.google.com/functions/docs/concepts/exec#auto-scaling_and_concurrency</a></p>
  <blockquote>
  <p>Note: An extremely rapid increase in inbound traffic can
  intermittently cause some requests to fail with an HTTP code of 500.
  This is because the requests are timing out in the pending queue while
  waiting for new instances to be created. Configuring your workload so
  that it ramps traffic up gradually over the course of a minute can
  help with this issue. Also see Troubleshooting Cloud Functions for
  more information.</p>
  </blockquote>
  <p>Thanks again everyone!</p>