hey sorry if this is a simple API
# spicedb
g
hey, sorry if this is a simple API misunderstanding question, but I can't seem to figure what I am doing wrong when using the Watch API. I'm using the following code to set up a simple watcher that watches all changes and receive it in a permanent running goroutine:
watchClient, err := handler.authzedClient.Watch(context.Background(), &v1.WatchRequest{
OptionalObjectTypes: []string{},
})
if err != nil {
fmt.Println("err: %w", err)
}
go func() {
for {
response, err := watchClient.Recv()
if err != nil {
fmt.Println("failed to receive watch update: %v", err)
break
}
if response != nil {
for _, event := range response.Updates {
// Process the event
fmt.Println("Received event: %s", event)
}
}
}
}()
when I get to the receive function, I keep bumping into this error:
rpc error: code = PermissionDenied desc = unknown request
when I do a checkpermission or any other request with the client, everything works perfectly fine. Can someone please sanity check me with what I'm missing? Thank you in advance!
this formatting is a bit wacky, sorry
e
how are you running spicedb?
g
I am connecting to the basic environment in the web app
e
oh, on authzed.com? The watch api is not enabled there
g
oh, that explains it
thank you very much! I thought I'm losing my mind
I'll set up a dockerized version of it tomorrow then and go forward with that
e
just fyi, authzed dedicated does give you your own DB / spicedb instances and Watch is enabled for those
but if you're just checking things out docker is the way to go
g
that's good to know as we are planning to move eventually to dedicated. currently we are at the early stages of development so I'm just creating the comprehensive poc for authzed
thanks again for the help