0

My table columns look like name, email, phone, and pin.

I'm using Hasura for collecting user details.

Problem:

I want to hash the pin field using some hashing algorithm. So I decided to have a separate AWS Lambda function to convert a plain pin to hashed one and update it to the same column.

enter image description here

Now I set a trigger (when pin get updated it will trigger the webhook). I successfully updated the hashed one to my database. But the problem is after lambda updated the field Hasura re-trigger the webhook again. The process is to keep on going until I shut down my Hasura instance.

In Hasura documentation they mentioned below

In case of UPDATE, the events are delivered only if new data is distinct from old data. The composite type comparison is used to compare the old and new rows. If rows contain columns, which cannot be compared using <> operator, then internal binary representation of rows by Postgres is compared.

however, after the lambda update, the data is same as old one but why it is kept on calling.

Akash D
  • 780
  • 2
  • 11
  • 27

1 Answers1

0

I think you should use action for this instead of trigger. With that way, database only store hashed pin.

ShinaBR2
  • 2,519
  • 2
  • 14
  • 26