Skip to content

Commit 28743d9

Browse files
committed
fix(astro): Try-catch controller.close() usage
1 parent 406422b commit 28743d9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/astro/src/server/middleware.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,12 @@ async function instrumentRequest(
194194
sendErrorToSentry(e);
195195
controller.error(e);
196196
} finally {
197-
controller.close();
197+
// try catch this, as it could have been manually closed by a user-land middleware
198+
try {
199+
controller.close();
200+
} catch {
201+
// we assume this means it was already closed
202+
}
198203
}
199204
},
200205
});

0 commit comments

Comments
 (0)