Open rehacktive opened 1 year ago
I'm getting the same issue here.
Any updates on this?
Alright created a fix for this issue PR.
The problem was that the Rpc()
method on line 64 in the file client.go found in postgrest-go/pkg/client.go
is failing because the http.NewRequest
function isn't given the full REST_URL to the supabase project. Currently it's getting /rpc/[function_name]
, when it should be https://$SUPABASE_URL/rest/v1/rpc/[function_name]
.
As a temporary solution until the PR is accepted you can overwrite the file $HOME/go/pkg/mod/github.com/nedpals/postgrest-go@[latest_version]/pkg/client.go
and replace line 64 with:
url := c.Transport.baseURL.String() + "/rpc/" + f
req, err := http.NewRequest("POST", url, bytes.NewBuffer(b))
Cheers!
Updated the PR again because I ran into http.bodyEOFSignal
errors when the Postgres function is more complex.
Also, I rewrote the Rpc
method to work similar to the From
method, this way users can determined what data type they get back, if they are expecting something.
The PR has been accepted but the new tag hasn't been released so it won't work until then
Hello, I've tried to use the client rpc call with something like:
client.DB.Rpc("search",....)
but I get the error:
Post "/rpc/public/search": unsupported protocol scheme ""
I think there's an issue with the baseURL in the client maybe? can you help? thanks