googleapis/go-gorm-spanner

rpc error: code = NotFound desc = Instance not found

Derick317 opened this issue · 0 comments

Hi, I tried to connect google postgreSQL by gorm.

Here is my code:

dialector := spannergorm.New(spannergorm.Config{
    DriverName: "spanner",
    DSN:        "projects/gothic-xxxx-xxxx/instances/myinstance/databases/temp_db",
})
db, err := gorm.Open(dialector, &gorm.Config{PrepareStmt: true})
if err != nil {
    return err
}
fmt.Println("Connected to PostgreSQL database successfully!")
if err = db.AutoMigrate(&model.User{}); err != nil {
    return err
}

gorm.Open succeeded, but later operations failed:

rpc error: code = NotFound desc = Instance not found: projects/gothic-xxxx-xxxx/instances/myinstance
error details: name = ResourceInfo type = type.googleapis.com/google.spanner.admin.instance.v1.Instance resourcename = projects/gothic-xxxx-xxxx/instances/myinstance owner =  desc = Instance does not exist.

However, I have an instance called myinstance.
image
I don't know what happened.