title: 500 on Google Cloud Run: The request failed because the instance could not start successfully
body: <p>I'm doing load testing on an ExpressJS app hosted on Google Cloud Run, upon spike increase in traffic, there is a period where I see many 500 errors in Stackdriver with the message "The request failed because the instance could not start successfully." - which effectively leads to server downtime.</p>
  
  <p>Seeing that this error occurs more frequently as the app scales up, I'm thinking this is caused by the Cloud Run load balancer assigning traffic prematurely to new instances, before these instances are ready to accept requests.</p>
  
  <p>As I continue to run the load test, the instances are continuously and repeatedly killed and restarted, so there is no mechanism for recovery while the load is on.</p>
  
  <p>I don't see any error logs from my NodeJS application, suggesting none of the failed requests actually reached my app.</p>
  
  <p>What can I do to avoid these errors?</p>
  
  <p>How does Cloud Run determine that a port is ready to accept requests?</p>
  
  <p>Is it something I misconfigured in my ExpressJS app or can I somehow delay Cloud Run a bit before sending requests to a new instance?</p>