fix: Scheduled task test page crashes on empty payloads#3411
fix: Scheduled task test page crashes on empty payloads#3411avasis-ai wants to merge 1 commit intotriggerdotdev:mainfrom
Conversation
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @avasis-ai, thanks for your interest in contributing! This project requires that pull request authors are vouched, and you are not in the list of vouched users. This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details. |
Summary
Fixes #3316
The test page for a scheduled task throws an uncaught
TypeErrorand fails to load when any run for that task has an empty payload ("").Problem
In
TestTaskPresenter.server.ts,getScheduleTaskRunPayloadcallsparsePacketwhich returnsundefinedwhendatais empty. The function then accessespacket.timezoneonundefined, throwing aTypeErrorthat crashes the presenter.Fix
Added a null guard for
packetingetScheduleTaskRunPayload. WhenparsePacketreturnsundefined(empty/malformed payload), the function now returns{ success: false }instead of crashing. The existing.filter(Boolean)in the caller already handles this case by silently skipping invalid runs.Reproduction
TaskRunrecord withpayload = ""andpayloadType = "application/json"