hasura / hasura/graphql-engine

"Event Trigger already exists" error even if it does not actually exist

Open
#9,703 3 comments 0 reactions 0 assignees View on GitHub
a/eventing/data-triggers k/bug t/gql-services
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version:
GraphQL Engine 2.22.0

### Environment

Dockerized Hasura GraphQL Engine running on Ubuntu 18.04

### What is the current behaviour?

I am trying to create a trigger that triggers on delete. I want to name it "delete_node". I have created many triggers already and all works, but on this one I continuosly get "Event trigger delete_node already exists".

What I have tried already:

- Reload metadata and DB
- Export metadata and re import
- Export metadata and check if this event trigger exists there... but is not there

I do not understand why this is happening, since the trigger is not in the metadata.

- Is "delete_node" some reserved keyword?
- Is there anoter place where event_triggers are saved other than the metadata? On the Postgres DB?

### What is the expected behaviour?

Event trigger should be created normally

### How to reproduce the issue?

Not possible to reproduce without having my DB

### Screenshots or Screencast

Not useful

### Please provide any traces or logs that could help here.

```json
{
"detail":{
"http_info":{
"content_encoding":null,
"http_version":"HTTP/1.1",
"ip":"172.21.0.1",
"method":"POST",
"status":400,
"url":"/v1/metadata"
},
"operation":{
"error":{
"code":"already-exists",
"error":"Event trigger with name \"delete_node\" already exists",
"path":"$.args[0].args"
},
"query":{
"type":"bulk"
},
"request_id":"36b225a9-0e7d-40b8-bcdd-4da80a1626b7",
"request_mode":"error",
"response_size":114,
"uncompressed_response_size":114,
"user_vars":{
"x-hasura-role":"admin"
}
},
"request_id":"36b225a9-0e7d-40b8-bcdd-4da80a1626b7"
},
"level":"error",
"timestamp":"2023-06-07T13:07:29.431+0000",
"type":"http-log"
}

```
### Any possible solutions/workarounds you're aware of?

Change name. But would break all my naming convention

### Keywords

events, triggers, delete, node, already exists

Contributor guide

Open the contributing guide

Research direction

Start with the POST /v1/metadata request and the event-trigger creation operation described in the logs. Check how the engine detects an existing delete_node trigger and compare that lookup with exported metadata and the database state. Done means the cause of the false already-exists response is identified and a reproducible case or regression test demonstrates normal creation.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, postgresql
Domain
api, backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.