DB Trigger is not being listened by my local instance #9700
-
Whats up Hasura team I have this scenario which I don't know if it is supported or not I have a DB in staging and I have hasura instance pointing to that DB I also have a local hasura instance pointing to the same DB So in other words I have 2 hasura instances connected to the same DB Now whenever I change something on a table and that table has a trigger listening I don't always receive the changes in my local instance, instead the trigger only broadcast the changes to one of the two instances but not both Why is this? Is this by design? Is there a workaround? This only happens if the trigger definition exists in both metadata (staging and local), if the metadata exists only in local the trigger is successfully received I'm on a self hosted instance with version: 2.17.0 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Event Triggers tries to deliver each event only once (more precisely atleast-once) even if there are multiple Hasura instances connected to the same DB. This is by design. Curious to know what application you are building which requires multiple delivery of same events. Note that multiple Hasura instance here means that the instances all share the same metadata. If they are completely different deployments (i.e. different metadata) then the delivery mechanism can be undefined. Hence, using event triggers on the same DB but with different metadata is not recommended unless you are sure about what you are doing. See caveat here: https://hasura.io/docs/latest/event-triggers/create-trigger/#introduction |
Beta Was this translation helpful? Give feedback.
-
first off, thanks a lot for the answer. This is not a special app it is just we have one DB for local and staging and sometimes we need to iterate over the triggers, for example
any ideas of an elegant way of handling this? Right now we are creating a new trigger called V2 and using that in local, we are not commiting this metadata Just in case, we can't have another DB only for local, the reason is the staging DB is actually a third party system, having a local would require have some sort of sync between staging and local that would require some manual intervention to keep data up to date |
Beta Was this translation helpful? Give feedback.
Event Triggers tries to deliver each event only once (more precisely atleast-once) even if there are multiple Hasura instances connected to the same DB. This is by design. Curious to know what application you are building which requires multiple delivery of same events.
Note that multiple Hasura instance here means that the instances all share the same metadata. If they are completely different deployments (i.e. different metadata) then the delivery mechanism can be undefined. Hence, using event triggers on the same DB but with different metadata is not recommended unless you are sure about what you are doing. See caveat here: https://hasura.io/docs/latest/event-triggers/create-trigger/#i…