appengine
                                
                                 appengine copied to clipboard
                                
                                    appengine copied to clipboard
                            
                            
                            
                        I keep on getting this error when connecting
Using proxy is slow, so I tried to connect using direct connection. I got this error
dial unix /cloudsql/trader-2333:us-central1:test/.s.PGSQL.5432: connect: no such file or directory panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x98 pc=0x1656836]
Im using Gorm to connect to the database
- My app.yaml file
runtime: go
env: flex
manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10
env_variables:
  POSTGRES_CONNECT: "host=/cloudsql/trader-2333:us-central1:test user=name dbname=test password=sadasdasd"
database.go
package common
import (
	"fmt"
	"os"
	"github.com/jinzhu/gorm"
	// brings postgresql into scope
	_ "github.com/jinzhu/gorm/dialects/postgres"
)
var DB *gorm.DB
func InitDB() *gorm.DB {
	datastoreName := os.Getenv("POSTGRES_CONNECT")
	db, err := gorm.Open("postgres", datastoreName)
	if err != nil {
		fmt.Println(err)
		return nil
	}
	fmt.Println("Connected to the Database")
	DB = db
	return DB
}
What is the problem?
I don't quite understand your question. Are you experiencing this issue when running locally or in production?