ajmallesh
05/28/2025, 9:15 PM// GetGroupMembers gets existing group members from SpiceDB
func GetGroupMembers(ctx context.Context, client *authzed.Client, groupID string) ([]string, error) {
namespace := globalNamespace
resp, err := client.ReadRelationships(ctx, &v1.ReadRelationshipsRequest{
RelationshipFilter: &v1.RelationshipFilter{
ResourceType: namespace + "/group",
OptionalResourceId: groupID,
OptionalRelation: "member",
},
})
if err != nil {
return nil, fmt.Errorf("failed to read relationships: %w", err) // <- NOT hitting this error
}
var members []string
for {
rel, err := resp.Recv()
if err == io.EOF {
break
}
if err != nil {
return nil, fmt.Errorf("failed to receive relationship: %w", err) // <- hitting the error here
}
// Get the user ID from the subject
userID := rel.Relationship.Subject.Object.ObjectId
members = append(members, userID)
}
return members, nil
}
This issue only occurs in our hosted environments using SpiceDB Serverless, and not locally. Does anyone know when streaming will be available in Serverless, and what the current workaround for this is?yetitwo
05/28/2025, 9:31 PMRecv()
loop and not on the original client request?yetitwo
05/28/2025, 9:31 PMajmallesh
05/28/2025, 9:43 PMyetitwo
05/28/2025, 10:29 PMif err == io.EOF {
break
}
we use errors.Is
in our test code for the same functionality.
if that's unrelated, i'd make sure that a zed
call with the same arguments as you're making in your code succeeds - there may be something with the prefixes that's weird.Joey
05/29/2025, 2:15 AM