Hey all! We are new to SpiceDb and have
# spicedb
j
Hey all! We are new to SpiceDb and have encountered an issue with deleting relationships using the Node client. The code is as follows: > const relationshipDelete = { > relationship: v1.Relationship.create({ > resource: enterpriseReference, > relation: "member", > subject: v1.SubjectReference.create({ > object: agentReference, > }), > }), > operation: v1.RelationshipUpdate_Operation.DELETE, > }; > > const deleteRelationshipRequest = { > updates: [relationshipDelete], > }; > > try { > await performRelationshipDeleteOperation(deleteRelationshipRequest); > console.log(
Deleted relationship for inactive agent: ${agentId}
); > } catch (error) { > logger.error(error, { > context: "Error deleting relationship for inactive agent", > agentId: agentId, > }); > } > > async function performRelationshipDeleteOperation(request) { > return new Promise((resolve, reject) => { > client.deleteRelationships(request, (err, response) => { > if (err) { > console.error("Error in delete operation:", err); > reject(err); > } else { > resolve(response); > } > }); > }); > } Whenever we run this we get the error: > Request message serialization failure: Cannot read properties of undefined (reading 'length')","level":"error","message":"13 INTERNAL: Request message serialization failure: Cannot read properties of undefined (reading 'length')","metadata":{} > Any ideas?
I think we figured it out. Converting our code to TypeScript gave us some hints.