Skip to content

Commit

Permalink
fix(nextjs): Prevent webpack 5 from crashing server (#3642)
Browse files Browse the repository at this point in the history
It seems that awaiting a flush() call is throwing errors in
Webpack 5. This crashes the server as the handler has already
sent a response at that point. This patch wraps the flush call
in a try, catch until we can figure out a better fix.
  • Loading branch information
AbhiPrasad committed Jun 2, 2021
1 parent 843bc28 commit 6c1b4bd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/nextjs/src/utils/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ export const withSentry = (handler: NextApiHandler): WrappedNextApiHandler => {

transaction.finish();
}
await flush(2000);
try {
await flush(2000);
} catch (e) {
// no-empty
}
}
};
};

0 comments on commit 6c1b4bd

Please sign in to comment.