Scheduler jobs register but never execute; listJobs() returns empty immediately after runJob() (reproduces on published unlisted app)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- node.js, typescript
- Domain
- backend
Research direction
No source file or test is named. Start by tracing the Devvit.addSchedulerJob registration and the context.scheduler.runJob() and listJobs() entry points using the supplied reproduction; compare one-shot and cron scheduling. Done means a returned job appears in listJobs() and its onRun handler executes for uploaded and published-unlisted apps.
Written by the indexing model from the issue text.
Description
Summary
context.scheduler.runJob() returns a valid job UUID, but the job never executes. context.scheduler.listJobs() returns an empty array immediately after runJob() returns. This affects both recurring cron jobs and one-shot runAt jobs. Menu item handlers and AppInstall / AppUpgrade triggers fire correctly on the same app, so the issue is isolated to the scheduler itself.
The behavior reproduces on both an uploaded (private) app and a published (unlisted) app, ruling out publish status as a factor.
Environment
- App slug:
rapids-match-bot - App URL: https://developers.reddit.com/apps/rapids-match-bot
- Devvit CLI:
0.12.13 @devvit/public-api: latest at time of build- App versions tested:
0.0.3through0.0.14(all exhibit the bug) - Publish status when bug reproduces: both
uploaded(v0.0.13) andpublished unlisted(v0.0.14) - Test subreddit:
r/rapids_match_bot_dev(private dev sub, mod-installed) - Node: 22
Steps to reproduce
- Register a scheduler job at the top level:
Devvit.addSchedulerJob({
name: JOB_CHECK_MATCHES,
onRun: checkMatchesJob,
});
- In an
AppInstall/AppUpgradetrigger, first iteratelistJobs()andcancelJob()each (per #239 mitigation), then call:
const jobId = await context.scheduler.runJob({
name: JOB_CHECK_MATCHES,
runAt: new Date(Date.now() + 60_000),
});
await context.redis.set('cronJobId', jobId);
- Note that
jobIdis a valid UUID and is persisted to Redis successfully. - Immediately call
context.scheduler.listJobs()from a moderator menu item.
Observed behavior
runJob()returns a valid UUID (e.g.9225215c-f9df-4304-8069-4bf8c4f1da2c).listJobs()returns[].- The registered job never executes. No
onRuninvocation. No log output. No side effects (no Reddit post submitted from inside the handler, even when the handler is reduced to a singlesubmitPostcall as a smoke test). - This is true for both
cronrecurring jobs andrunAtone-shot jobs. - This is true on the uploaded version (v0.0.13) and on the published unlisted version (v0.0.14).
Expected behavior
runJob()returns a UUID.listJobs()returns a non-empty array containing that UUID.- The job's
onRunhandler executes at the scheduled time.
Diagnostic evidence
A moderator menu item posts a self-post showing the stored job ID and the result of listJobs():
Scheduler Status — 0 active job(s)
Stored cronJobId: 9225215c-f9df-4304-8069-4bf8c4f1da2c
Active jobs: No active jobs found.
The stored ID changes across upgrades (v0.0.13 stored 085a820b-da46-4235-bf05-febac368531d; v0.0.14 stored 9225215c-f9df-4304-8069-4bf8c4f1da2c), confirming the AppUpgrade trigger is firing and runJob() is being called and returning successfully each time. The job simply never appears in listJobs() and never executes.
What I've already tried (ruled out as causes)
- Cron expression syntax. Failure reproduces with
runAt: new Date(...)one-shot jobs, not just cron. runAtvswhenparameter. Confirmed against the installed@devvit/public-apitypes thatrunAtis the correct parameter;whenproduces a TS2353 type error. Both forms fail at runtime regardless.- Ghost schedules (#239). Cleanup loop iterating
listJobs()andcancelJob()runs at the top of everyAppInstall/AppUpgradetrigger before any newrunJob()calls. No effect. - Self-rescheduling one-shot pattern. Replaced cron with a
runAtjob that re-schedules itself at the end ofonRun. Same failure: the first job never fires, so the chain never starts. - Trigger registration.
AppInstallandAppUpgradetriggers are confirmed firing (Redis writes happen, console logs appear indevvit logs). - Menu items. Menu item
onPresshandlers execute correctly, includingsubmitPostcalls. The app is fully functional except for scheduled execution. - App publish status. Bug reproduces on both uploaded and published-unlisted versions.
Question
Is there a known issue with scheduler execution on apps installed in private subreddits, or some other configuration gate I'm missing? Given that runJob() returns successfully but listJobs() shows nothing, it looks like the scheduler is silently dropping registered jobs. Any guidance on how to debug further from the application side would be appreciated.
Related
- #239 (ghost schedules from reinstallation; mitigation applied, does not resolve this)
- Dominant language
- TypeScript
- Stars
- 210
- Forks
- 88
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from reddit/devvit
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 5/5 Over a week Newbie friendliness 42/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
area:tools bug good first issue help wanted priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
TaewoooPark/Motifcode#14 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
newrelic-experimental/preflight#793 · 1 comment ·
-
bug 🐞
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
BasedHardware/omi#15320 ·