hasura / hasura/graphql-engine
CRON Events: Unable to set Intervals when having multiple hour periods
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version: v2.33.0 (Docker)
### What is the current behaviour?
When I create a CRON trigger, I'm setting the expression as `0 19-23/2,0-8/2 * * *` , which means that the events will trigger every two hours from 19:00 till 08:00. But when I try to create an CRON event, it's giving me an error `' ': Failed reading: satisfy`.
### What is the expected behaviour?
It should allow us to create the CRON event as it is valid expression. You can check this [link](https://crontab.guru/#0_19-23/2,0-8/2_*_*_*).
### How to reproduce the issue?
1.Go to Admin Console -> Events Section -> CRON Trigger.
2.Create CRON Trigger, with CRON expression as `0 19-23/2,0-8/2 * * *` & fill up rest of the details.
### Screenshots or Screencast

### Please provide any traces or logs that could help here.
**Logs**
```
2023-11-08 18:14:25 {"detail":{"http_info":{"content_encoding":null,"http_version":"HTTP/1.1","ip":"172.20.0.1","method":"POST","status":400,"url":"/v1/metadata"},"operation":{"error":{"code":"parse-failed","error":"' ': Failed reading: satisfy","path":"$.args[0].args.schedule"},"query":{"type":null},"request_id":"d05b25f7-8d43-481e-907d-1ba7ae3ec735","request_mode":"error","response_size":95,"uncompressed_response_size":95,"user_vars":{"x-hasura-role":"admin"}},"request_id":"d05b25f7-8d43-481e-907d-1ba7ae3ec735"},"level":"error","timestamp":"2023-11-08T12:44:24.909+0000","type":"http-log"}
```
**Docker YML**
```
version: '3.6'
services:
postgres:
image: postgres:13.7
restart: always
ports:
- "5432:5432"
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: postgrespassword
graphql-engine:
image: hasura/graphql-engine:v2.33.0
ports:
- "8080:8080"
depends_on:
- "postgres"
restart: always
environment:
## postgres database to store Hasura metadata
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:123@host.docker.internal:5432/test
## this env var can be used to add the above postgres database to Hasura as a data source. this can be removed/updated based on your needs
PG_DATABASE_URL: postgres://postgres:123@host.docker.internal:5432/test
## enable the console served by server
HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console
## enable debugging mode. It is recommended to disable this in production
HASURA_GRAPHQL_DEV_MODE: "true"
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
volumes:
db_data:
```
### Keywords
Admin Console
Events
CRON Triggers
Contributor guide
Research direction
Start in Admin Console → Events → CRON Trigger and reproduce the failure with `0 19-23/2,0-8/2 * * *`. Trace the metadata request at `$.args[0].args.schedule` and the reported `parse-failed` response; done means this valid expression can create a CRON event without the parsing error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100