Skip to content

Commit 5fabd93

Browse files
committed
fix top level await in the middleware
1 parent 91f8c62 commit 5fabd93

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/open-next/src/core/nodeMiddlewareHandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ export default async function middlewareHandler(
2929
): Promise<Response> {
3030
if (!_module) {
3131
// We use await import here so that we are sure that it is loaded after AsyncLocalStorage is defined on globalThis
32-
// TODO: We will probably need to change this at build time when used in a monorepo (or if the location changes)
32+
// We need both await here, same way as in
3333
//@ts-expect-error - This file should be bundled with esbuild
34-
_module = (await import("./.next/server/middleware.js")).default;
34+
_module = await (await import("./.next/server/middleware.js")).default;
3535
}
3636
const adapterFn = _module!.default || _module;
3737
const result = await adapterFn({

0 commit comments

Comments
 (0)