hasura / hasura/graphql-engine

Cron Triggers in Hasura is not working locally when I created it via metadata API.

Open
#9,341 4 comments 1 reaction 0 assignees View on GitHub
k/bug
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: 2.16.1
CLI Version (for CLI related issue): 2.16.1

### Environment

OSS / Cloud

### What is the current behavior?

- Cron Triggers in Hasura is not working locally when I created it via metadata API.
- On the Cloud version it's working correctly though.
- The event is getting created successfully but the pending events list is empty.
- When I try to delete the event it throws an error like it does not exist.
- If we create the event via the console it works. I actually need to use it via API only.
- The first time I create it via API and deleted it via API things are fine.
- In the same instance if I go a second time then pending events do not populate.

https://hasura.io/docs/latest/api-reference/metadata-api/scheduled-triggers/#metadata-create-cron-trigger

### What is the expected behavior?

- The pending events should get populated irrespective of how i create the event
- The cron events should fire as provided in the schedule

### How to reproduce the issue?

1. Spin up a Hasura instance locally using docker-compose
2. Call metadata API to create a cron trigger & using API it self delete it
3. Repeat 2 steps in the same instance. Now you can see that the pending events is not getting populated and the events are not getting fired

### Screenshots or Screencast

![Hasura Bug](https://user-images.githubusercontent.com/29562232/209728531-2f9def5e-04f3-42da-bfef-2cc5b8486643.png)

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

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

- I use the console to create one more dummy trigger to make failed Tiggers load
- Use the cloud version but in that case lot of port forwarding needs to do

### Keywords

cron

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with a local docker-compose Hasura instance through the metadata API's create and delete cron-trigger operations. Compare the repeated API-created trigger with a console-created trigger, then verify that pending events populate and cron events fire after the second create/delete cycle.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker-compose, graphql
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.