From 5ef6fa34d98cedb32ce76b708625da78c8b7b4b2 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Wed, 14 Jun 2023 08:23:51 +1000 Subject: [PATCH] fix: use `await Deno.serve().finished` (#1287) [A recent change in the runtime](https://github.com/denoland/deno/pull/19485) has changed the behaviour of `Deno.serve()` such that it throws when called a promise. The correct way to do it is instead to call `Deno.serve().finished` as a promise. This PR does that. Fixes https://github.com/denoland/fresh/pull/1286#issuecomment-1589987387 --- src/server/mod.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/mod.ts b/src/server/mod.ts index f5730e8e..82a57988 100644 --- a/src/server/mod.ts +++ b/src/server/mod.ts @@ -128,7 +128,7 @@ export async function start(routes: Manifest, opts: StartOptions = {}) { async function bootServer(handler: ServeHandler, opts: StartOptions) { if (opts.experimentalDenoServe === true) { // @ts-ignore as `Deno.serve` is still unstable. - await Deno.serve({ ...opts, handler }); + await Deno.serve({ ...opts, handler }).finished; } else { await serve(handler, opts); }