Skip to content

Commit 83099b9

Browse files
committed
fix: handle empty payloads in scheduled task test page (#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.
1 parent 73ea586 commit 83099b9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

apps/webapp/app/presenters/v3/TestTaskPresenter.server.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,11 @@ export class TestTaskPresenter {
382382

383383
async function getScheduleTaskRunPayload(payload: string, payloadType: string) {
384384
const packet = await parsePacket({ data: payload, dataType: payloadType });
385+
386+
if (!packet) {
387+
return { success: false as const, error: new Error("Empty payload") };
388+
}
389+
385390
if (!packet.timezone) {
386391
packet.timezone = "UTC";
387392
}

0 commit comments

Comments
 (0)