Skip to content

Commit

Permalink
L-1563 Replace ev.waitUntil(logger.flush()) by await logger.flush()
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrHeinz committed Feb 16, 2024
1 parent 1aae1a3 commit 3539617
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/withLogtail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,13 @@ export function withLogtailNextEdgeFunction(handler: NextMiddleware): NextMiddle
if (res) {
logger.attachResponseStatus(res.status);
}
ev.waitUntil(logger.flush());
await logger.flush();
logEdgeReport(report);
return res;
} catch (error: any) {
logger.error('Error in edge function', { error });
logger.attachResponseStatus(500);
ev.waitUntil(logger.flush());
await logger.flush();
logEdgeReport(report);
throw error;
}
Expand Down

0 comments on commit 3539617

Please sign in to comment.