fix: handle empty payloads in scheduled task test page (#3316)#3382
fix: handle empty payloads in scheduled task test page (#3316)#3382avasis-ai wants to merge 1 commit intotriggerdotdev:mainfrom
Conversation
…#3316) When parsePacket returns undefined for empty data (e.g. payload=''), getScheduleTaskRunPayload crashes accessing .timezone on undefined. Add a null guard that returns a failed SafeParse result so the run is gracefully skipped by the existing filter(Boolean) logic.
|
|
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
In
TestTaskPresenter.server.ts,getScheduleTaskRunPayloadcallsparsePacketwhich returnsundefinedwhen the payload data is empty (e.g.""). The function then accesses.timezoneonundefined, throwing aTypeErrorthat crashes the test page presenter.Fix: Add a null guard after
parsePacket— when the result is falsy, return a failedSafeParse-compatible result ({ success: false }). This causes the run to be filtered out by the existing.filter(Boolean)on line 355 and the template check on line 368, so the test page loads normally.Changes
apps/webapp/app/presenters/v3/TestTaskPresenter.server.ts: Added early return ingetScheduleTaskRunPayloadwhenparsePacketreturnsundefinedTesting
payload="",payloadType="application/json") are skipped without crashing