Hey all, we are using SpiceDB Serverless
# spicedb
a
Hey all, we are using SpiceDB Serverless, and getting this error using the Recv() function: 'failed to receive relationship: rpc error: code = InvalidArgument desc = " ' We also get a similar issue when we try to use LookupSubjects: 'failed to receive from stream: rpc error: code = InvalidArgument desc = " ' Here is our code for reference:
Copy code
// 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?
y
so the error is happening inside the
Recv()
loop and not on the original client request?
those methods should be working just fine in serverless
a
yes the issue is in the recv() loop. i edited the original message to point out the error line we are hitting, and it's NOT the originial client request
y
I'm not 100% sure here, but this line looks weird to me:
Copy code
if 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.
j
you likely have an invalid prefix on something
5 Views