Skip to content

Commit 4f2a1a3

Browse files
committed
fix: scheudled handler support
1 parent d151055 commit 4f2a1a3

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

packages/wrangler/src/api/server.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,9 @@ export function createServer(options: ServerOptions): WorkerServer {
591591
async scheduled(scheduledOptions) {
592592
const session = await resolveSession();
593593
const miniflare = await getRuntimeMiniflare(session);
594-
const url = new URL("http://localhost/cdn-cgi/handler/scheduled");
594+
const url = new URL(
595+
"http://localhost/cdn-cgi/handler/scheduled?format=json"
596+
);
595597

596598
if (scheduledOptions?.cron !== undefined) {
597599
url.searchParams.set("cron", scheduledOptions.cron);
@@ -605,13 +607,9 @@ export function createServer(options: ServerOptions): WorkerServer {
605607
}
606608

607609
const response = await dispatchFetch(miniflare, url, undefined, name);
608-
const outcome = await response.text();
610+
const result = await response.json();
609611

610-
return {
611-
outcome,
612-
// FIXME: scheduled handler should include noRetry info in the response
613-
noRetry: false,
614-
};
612+
return result as FetcherScheduledResult;
615613
},
616614
};
617615
},

0 commit comments

Comments
 (0)