Add Node Predicates to Lambda Update/Delete Webhooks

Currently, the update/delete webhook resolver only get a list of dgraph-internal UIDs (rootUIDs).

It would be great, if we could also get all predicates for the deleted nodes (similar to how field resolvers work), as sometimes (I’d argue even most of the time) we need to do actions based on them.

I don’t want to learn another query language (DQL) just to be able to retreive the predicates I need.

@graphql I posted lots of bugs/improvements for lambda-graphql lately. And I don’t get many responses. Can I have an update on this?

Edit: Included Update-Webhooks.

Edit2: I totally forgot about adding the ID type to my nodes:

type Foo {
   id: String! @id
   rootID: ID! # <- new

Now I can retrieve my nodes via GraphQL by referencing rootID.

Although this works, I consider this to be a temporary solution because it’s not very efficient. I have to do a 2nd GraphQL lookup every time an update- or delete mutation is fired to retrieve all predicates I need.


The workaround posted above is only valid for update webhooks!

When trying to query the node after onDelete has been called, there is no way to retrieve any field predicates because the node is already deleted.

Can I please have any opinion/estimated time from the dgraph/graphql team on this?

Also, can someone of the mods mark this as a bug? The delete webhook is clearly unusable in its current state.

This is 100% another use case for pre-hooks. I completely agree. I have been commenting on this since last year, although there seems to be no fix here, or plans to do so.

If they are so adamant that pre-hooks will never exist, post-hooks need to contain a way to get back the information that was deleted.

The Event object would need to have the old data. This is how Firebase Functions work. However, this is not even feasible, as Firestore is a noSQL database. Getting back complex deletions and mutations in a GraphDB would be way more complicated.

Either way, maybe this is the best we can hope for:

Feature Request: - Add Old Data to Update Mutation and Delete Mutation to the Event Object in Lambda Webhooks.


1 Like