Closed irohitb closed 1 year ago
setup_workspace type generated on client looks like this
setup_workspace: { Args: { refresh_token: string user_email: string name: string is_admin: string workspace_name: string }
In go, when I am calling it
supabaseReqData := supabase.SetupWorkspaceRequest{ Name: userData.Name, UserEmail: userData.Email, RefreshToken: request.RefreshToken, IsAdmin: userData.IsAdmin, WorkspaceName: userData.Hd, } payload, err := json.Marshal(supabaseReqData) if err != nil { fmt.Println("Error encoding JSON:", err) return } result := db.Rpc("setup_workspace", "", string(payload))
it is throwing the following error: "message":"No API key found in request"
"message":"No API key found in request"
Here supabase.SetupWorkspaceRequest
type SetupWorkspaceRequest struct { RefreshToken string `json:"refresh_token"` UserEmail string `json:"user_email"` Name string `json:"name"` IsAdmin bool `json:"is_admin"` WorkspaceName string `json:"workspace_name"` }
And db is db *postgrest.Client
db *postgrest.Client
I am initializing like this
supbaseDb := postgrest.NewClient(url,serviceRoleKey, nil) if supbaseDb.ClientError != nil { panic(supbaseDb.ClientError) } app.Db = supbaseDb
where url is this http://localhost:54321 and serviceRoleKey is what we get when we do supabase start (service_role key)
url
http://localhost:54321
serviceRoleKey
In NodeJs, this code would've like this
supbaseDb := postgrest.NewClient(url+"/rest/v1", "", map[string]string{ "service_role_key": serviceRoleKey, })
Changing it to this fixed it
supbaseDb := postgrest.NewClient(url+"/rest/v1", "", map[string]string{ "Authorization": "Bearer " + serviceRoleKey, "apikey": serviceRoleKey, })
Bug report
Describe the bug
setup_workspace type generated on client looks like this
In go, when I am calling it
it is throwing the following error:
"message":"No API key found in request"
Here supabase.SetupWorkspaceRequest
And db is
db *postgrest.Client
I am initializing like this
where
url
is thishttp://localhost:54321
andserviceRoleKey
is what we get when we do supabase start (service_role key)In NodeJs, this code would've like this