Skip to content

Commit 24c7694

Browse files
committed
fix: decode eventData from base64
1 parent e2567fe commit 24c7694

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/context/auto-executor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ export class AutoExecutor {
356356
body: JSON.stringify(waitBody),
357357
headers,
358358
method: "POST",
359-
parseResponseAsJson: false
359+
parseResponseAsJson: false,
360360
});
361361

362362
throw new QStashWorkflowAbort(steps[0].stepName, steps[0]);

src/workflow-parser.test.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ describe("Workflow Parser", () => {
228228
});
229229

230230
test("should overwrite the out field of wait step", async () => {
231+
const eventData = "notify-data";
231232
const timeoutStep: Step = {
232233
stepId: 1,
233234
stepName: "wait-step-name-1",
@@ -242,7 +243,7 @@ describe("Workflow Parser", () => {
242243
stepId: 2,
243244
stepName: "wait-step-name-2",
244245
stepType: "Wait",
245-
out: "notify-data",
246+
out: btoa(eventData),
246247
waitTimeout: false,
247248
waitEventId: "wait-event-2",
248249
concurrent: 1,
@@ -285,7 +286,7 @@ describe("Workflow Parser", () => {
285286
expect(steps[1].out).toEqual(timeoutResponse);
286287

287288
const notifyResponse: WaitStepResponse = {
288-
eventData: "notify-data",
289+
eventData,
289290
timeout: false,
290291
};
291292
expect(steps[2].out).toEqual(notifyResponse);

src/workflow-parser.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const parsePayload = (rawPayload: string) => {
7171
// if event is a wait event, overwrite the out with WaitStepResponse:
7272
if (step.waitEventId) {
7373
const newOut: WaitStepResponse = {
74-
eventData: step.out,
74+
eventData: step.out ? decodeBase64(step.out as string) : undefined,
7575
timeout: step.waitTimeout ?? false,
7676
};
7777
step.out = newOut;

0 commit comments

Comments
 (0)