fisker
(fisker)
September 22, 2019, 5:47pm
1
Hello, I couldn’t find any hits when googling the error with regard to unknown method Mutate
.
This is my docker-compose file:
version: "3.2"
services:
zero:
image: dgraph/dgraph:latest
volumes:
- type: volume
source: dgraph
target: /dgraph
volume:
nocopy: true
ports:
- 5080:5080
- 6080:6080
restart: on-failure
command: dgraph zero --my=zero:5080
server:
image: dgraph/dgraph:latest
volumes:
- type: volume
source: dgraph
target: /dgraph
volume:
nocopy: true
ports:
- 8080:8080
- 9080:9080
restart: on-failure
command: dgraph alpha --my=server:7080 --lru_mb=2048 --zero=zero:5080 --whitelist 172.23.0.1,192.168.1.1
ratel:
image: dgraph/dgraph:latest
volumes:
- type: volume
source: dgraph
target: /dgraph
volume:
nocopy: true
ports:
- 8000:8000
command: dgraph-ratel
volumes:
dgraph:
I establish connection on address 127.0.0.1:9080
and I’m using go module github.com/dgraph-io/dgo v1.0.0
.
Any help would be much appreciated
hawk
(gary)
September 23, 2019, 12:06pm
2
the same problem ,any one resolve it ?
amanmangal
(Aman Mangal)
September 23, 2019, 12:26pm
3
Could you share part of the code that is causing the issue so that I can reproduce the issue on my end?
fisker
(fisker)
September 23, 2019, 3:41pm
4
This gives me rpc error: code = Unimplemented desc = unknown method Mutate for service api.Dgraph
:
package main
import (
"context"
"encoding/json"
"github.com/dgraph-io/dgo"
"github.com/dgraph-io/dgo/protos/api"
"google.golang.org/grpc"
)
type Person struct {
UID string `json:"uid"`
Name string `json:"name"`
}
func main() {
conn, err := grpc.Dial("127.0.0.1:9080", grpc.WithInsecure())
if err != nil {
panic(err)
}
client := dgo.NewDgraphClient(api.NewDgraphClient(conn))
person := Person{
Name: "Alice",
}
plainJSON, err := json.Marshal(person)
if err != nil {
panic(err)
}
mut := &api.Mutation{
CommitNow: true,
SetJson: plainJSON,
}
_, err = client.NewTxn().Mutate(context.Background(), mut)
if err != nil {
panic(err)
}
}
And my go mod file:
module github.com/test/test
go 1.12
require (
github.com/dgraph-io/dgo v1.0.0
golang.org/x/net v0.0.0-20190921015927-1a5e07d1ff72 // indirect
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69 // indirect
golang.org/x/text v0.3.2 // indirect
google.golang.org/genproto v0.0.0-20190916214212-f660b8655731 // indirect
google.golang.org/grpc v1.23.1
)
amanmangal
(Aman Mangal)
September 23, 2019, 4:58pm
5
As the README says, dgo 2.0
is only compatible with dgraph 1.1
. You will have to change the import in your code to -
github.com/dgraph-io/dgo/v2
github.com/dgraph-io/dgo/v2/protos/api
2 Likes
fisker
(fisker)
September 23, 2019, 5:29pm
6
Oh wow, seems like there has been quite a few changed along with the new Type system… It’s working now, thanks
1 Like
hawk
(gary)
September 24, 2019, 2:18am
7
wow ,it works well ,thank you very much
1 Like
bh90210
(Byron)
October 9, 2019, 2:22pm
8
yeap, I too was experiencing the same problem and given solution works
I am using VSC and while going through client tutorial I relied on suggested imports thrown at me.
ranic
(Tina Ranic)
October 11, 2019, 12:16pm
9
Hi!
Im getting the same error with Dgraph4j, version 1.3.0. Any help?!
Exception in thread "main" io.grpc.StatusRuntimeException: UNIMPLEMENTED: unknown method Mutate for service api.Dgraph
Thanks!
martinmr
(Martin Martinez Rivera)
October 11, 2019, 5:56pm
10
Aman’s answer above applies to all the clients. If you are using dgraph 1.1, you need a newer version of the client since there are breaking changes in the API.