Provide environment information
n/a
Describe the bug
The test page for a scheduled task throws an uncaught TypeError and redirects with "Couldn't load test page for {task}" when any run for that task has an empty payload ("").
In TestTaskPresenter.server.ts, getScheduleTaskRunPayload calls parsePacket which returns undefined when data is empty. The function then does if (!packet.timezone), accessing .timezone on undefined throws, crashing the presenter.
The test page works fine in Development (different code path, queries backgroundWorkerTask directly). Production/Staging use findCurrentWorkerDeployment and then hit this run-processing path.
Expected: empty-payload runs are skipped gracefully, test page loads normally.
Reproduction repo
n/a
To reproduce
- Deploy a scheduled task to a staging/production environment
- Insert a
TaskRun record for that task with payload = "" and payloadType = "application/json"
- Navigate to the test page for that task in the non-dev environment
- Page fails to load with "Couldn't load test page for {task}"
Additional information
- Only affects scheduled tasks, the empty-payload code path is only hit in the
SCHEDULED branch of TestTaskPresenter, standard tasks are unaffected
- Not sure where empty payloads originate from in the first place
- Workaround: rename the task id (e.g.
"scheduled-task" → "scheduled-task-v2") and redeploy, since the schedule is declarative, it gets re-registered automatically for the new id and the test page works immediately (no bad runs). Downside: run history stays under the old task name.
Provide environment information
n/a
Describe the bug
The test page for a scheduled task throws an uncaught
TypeErrorand redirects with "Couldn't load test page for {task}" when any run for that task has an empty payload ("").In
TestTaskPresenter.server.ts,getScheduleTaskRunPayloadcallsparsePacketwhich returnsundefinedwhendatais empty. The function then doesif (!packet.timezone), accessing.timezoneonundefinedthrows, crashing the presenter.The test page works fine in Development (different code path, queries
backgroundWorkerTaskdirectly). Production/Staging usefindCurrentWorkerDeploymentand then hit this run-processing path.Expected: empty-payload runs are skipped gracefully, test page loads normally.
Reproduction repo
n/a
To reproduce
TaskRunrecord for that task withpayload = ""andpayloadType = "application/json"Additional information
SCHEDULEDbranch ofTestTaskPresenter, standard tasks are unaffected"scheduled-task"→"scheduled-task-v2") and redeploy, since the schedule is declarative, it gets re-registered automatically for the new id and the test page works immediately (no bad runs). Downside: run history stays under the old task name.