nedpals / supabase-go

Unofficial Supabase client library for Go.
https://pkg.go.dev/github.com/nedpals/supabase-go
MIT License
362 stars 69 forks source link

Post "/rest/v1/[tableName]": unsupported protocol scheme "" #41

Open devhindo opened 6 months ago

devhindo commented 6 months ago

It shows this error Post "/rest/v1/emails": unsupported protocol scheme "" when deploying from render.com server but it works fine locally. I don't know where the problem is

type Emaildb struct {
    Name    string `json:"name"`
    Subject string `json:"subject"`
    To      string `json:"to"`
    Text    string `json:"text"`
    Date   string `json:"date"`
}

func AddMail(m Emaildb) {
    supabaseUrl := os.Getenv("SUPABASE_URL")
    supabaseKey := os.Getenv("SUPABASE_PRIVATE_KEY_SERVICE_ROLE")
    supabase := supa.CreateClient(supabaseUrl, supabaseKey)

    var results []types.Email

    err := supabase.DB.From("emails").Insert(m).Execute(&results)
    if err != nil {
        fmt.Println("cant insert email to db" + err.Error())
    }

    fmt.Println(results)
}
devhindo commented 6 months ago

I think it has something to do with this

stav commented 2 months ago

I had the same error when I forgot to set my environment variables for the supabase url.