Skip to content

Instantly share code, notes, and snippets.

@dsandip
Created March 24, 2022 18:20
Show Gist options
  • Save dsandip/d8f0c0b84137a5f0339b2a14a4eb3d2b to your computer and use it in GitHub Desktop.
Save dsandip/d8f0c0b84137a5f0339b2a14a4eb3d2b to your computer and use it in GitHub Desktop.

Event Trigger issue

Details of the issue:

We have detected an error message similar to the following example, in some projects on Hasura Cloud:

“event trigger "foo_event_trigger" on table "foo" not found”

This happens when the event trigger definition no longer exists in the metadata but the associated Postgres trigger exists in the database which impacts the resource consumption in your project's database.

How to confirm this issue in your project

Follow the steps below to check if your have the relevant event triggers/ trigger definition:

  1. Make sure that the event trigger foo_event_trigger doesn’t exist To do this, visit console of the project > Go to events > search for foo_event_trigger Optionally metadata definition can be checked
  2. Check the postgres trigger definition notify_hasura_foo_event_trigger_INSERT/ notify_hasura_foo_event_trigger_UPDATE/ notify_hasura_foo_event_trigger_DELETE

exists on the table foo

The example below shows the Trigger notify_hasura_move_update_UPDATE exists for moves table

event_triggers

Steps to fix the issue:

  1. Go to Project console > DATA > SQL
  2. Check the pending events
select count(1) from hdb_catalog.event_log where trigger_name = '<event-trigger-name>' and archived = 'f';
  1. Archive the pending events so Hasura doesn’t process them (we have fixed the issue and we would be rolling it out soon)
BEGIN TRANSACTION;
update table hdb_catalog.event_log set archived = 't' where trigger_name = 'move_update' and archived = 'f';
COMMIT;
  1. Delete the pg_trigger

Visit console of the project > Go to data > table (table name from email) > Modify > Triggers and delete triggers found in the previous step “How to check”.

Do make sure not to delete any other triggers.

Performance observation:

Post this activity, Please check the DB resources. Please observe the performance over a couple of days before making any decision to scale down. We expect the performance to improve. Performance improvement is based on the number of undelivered events.

We have identified the root cause and fixed the underlying issue along with additional checks and balances to the overall process. Please feel free to reach out to us with any thoughts/questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment