Problem solved.
It seems I needed to use the same region as the web service.
I also found the same Issue.
databases:
- name: "Slack Bot DB"
databaseName: slack_bot_db
user: slack_bot_user
region: singapore
services:
- type: web
region: singapore
name: "Slack Bot Service"
env: python
buildCommand: "./scripts/build.sh"
startCommand: "gunicorn config.wsgi:application"
envVars:
- key: DATABASE_URL
fromDatabase:
name: "Slack Bot DB"
property: connectionString
- key: SECRET_KEY
generateValue: true
- key: WEB_CONCURRENCY
value: 4
- type: cron
region: singapore # <- required
name: post_questions_command
env: python
schedule: "0 1 * * *"
buildCommand: "poetry install"
startCommand: "poetry run python manage.py post_questions_command"
But it looks like Env Groups needs to be configured manually.
It would be useful to be able to configure it in yaml.