panic: runtime error: invalid memory address or nil pointer dereference only on the GAE : I am working on the golang app using gin framework. Basically it just fetch the data from firestore as json.

Localy it works perfectly but when I deploy it to the GAE (gcloud app deploy) there is no error during deployment but when access the page it does not work and in the logs provide an error: "panic: runtime error: invalid memory address or nil pointer dereference"

Can you please help me to resolve this frustrating problem.

Thank you in advance

Here is my go page:

package listcollections

import (
	"fmt"
	"log"
	"net/http"

	"cloud.google.com/go/firestore"
	"github.com/gin-gonic/gin"
	"google.golang.org/api/iterator"
	"google.golang.org/appengine"
)

func main() {

}

//GetListCollections function

func GetListCollections(c *gin.Context) {

	var coll []string
	ctx := appengine.NewContext(c.Request)
	
	projectID := "XXX"
	client, err := firestore.NewClient(ctx, projectID)
	if err != nil {
		log.Fatalf("Failed to create client: %v", err)
	}
	defer client.Close()

	iter := client.Collection("collection").Documents(ctx)

	for {

		doc, err := iter.Next()

		if err == iterator.Done {
			break
		}
		if err != nil {
			fmt.Println("ERROR")
		}

		coll = append(coll, doc.Data()["Title"].(string))

	}

	c.JSON(http.StatusOK, gin.H{
		"collections": coll,
	})

}