title: Using Cloud Firestore with AppEngine Go Standard Environment returns rpc error when running on AppEngline
body: <p>I'm trying to use Firestore in my AppEngine (standard environment) app written in Go. I've been following the "<a href="https://firebase.google.com/docs/firestore/quickstart" rel="nofollow noreferrer">Getting Started with Cloud Firestore"</a> guide and have been using the <a href="https://godoc.org/cloud.google.com/go/firestore" rel="nofollow noreferrer">firestore package</a> documentation to implement a simple example that works fine when running it on my local dev server.</p>
  
  <p>However when I deploy the app and try the deployed version the call to <a href="https://godoc.org/cloud.google.com/go/firestore#DocumentRef.Set" rel="nofollow noreferrer"><code>DocumentRef.Set()</code></a> fails with the error</p>
  
  <pre class="lang-none prettyprint-override"><code>rpc error: code = Unavailable desc = all SubConns are in TransientFailure
  </code></pre>
  
  <p>This is my code that reproduces the issue:</p>
  
  <pre class="lang-default prettyprint-override"><code>func init() {
      http.HandleFunc("/test", testHandler)
  }
  
  type testData struct {
      TestData string `firestore:"myKey,omitempty"`
  }
  
  func testHandler(w http.ResponseWriter, r *http.Request) {
      ctx := appengine.NewContext(r)
  
      var firestoreClient *firestore.Client
      var firebaseApp *firebase.App
      var err error
  
      conf := &amp;firebase.Config{ProjectID: "my-project"}
      firebaseApp, err = firebase.NewApp(ctx, conf)
  
      if err != nil {
          fmt.Fprintf(w, "Failed to create a new firestore app: %v", err)
          return
      }
  
      firestoreClient, err = firebaseApp.Firestore(ctx)
      if err != nil {
          fmt.Fprintf(w, "Failed to create a new firestore client: %v", err)
          return
      }
  
      data := testData{"my value"}
      _, err = firestoreClient.Collection("testCollection").Doc("testDoc").Set(ctx, data)
      if err != nil {
          fmt.Fprintf(w, "Failed to create a firestore document: %v", err)
          return
      }
      firestoreClient.Close()
      fmt.Fprint(w, "Data stored in Firestore successfully")
  }
  </code></pre>
  
  <p>As mentioned before, on the dev server this works fine. So there the returned page contains the text <code>Data stored in Firestore successfully</code>.</p>
  
  <p>When running the deployed code I get <code>Failed to create a firestore document: rpc error: code = Unavailable desc = all SubConns are in TransientFailure</code> instead. Why do I get this error and how can I avoid it?</p>