Skip to content

Commit

Permalink
don't use CSR fallback when the headers are changed after the respons…
Browse files Browse the repository at this point in the history
…e is sent
  • Loading branch information
artlowel committed Apr 6, 2021
1 parent ff4bd59 commit 3c93777
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server.ts
Expand Up @@ -160,6 +160,11 @@ function ngApp(req, res) {
}, (err, data) => {
if (hasNoValue(err) && hasValue(data)) {
res.send(data);
} else if (hasValue(err) && err.code === 'ERR_HTTP_HEADERS_SENT') {
// When this error occurs we can't fall back to CSR because the response has already been
// sent. These errors occur for various reasons in universal, not all of which are in our
// control to solve.
console.warn('Warning [ERR_HTTP_HEADERS_SENT]: Tried to set headers after they were sent to the client');
} else {
console.warn('Error in SSR, serving for direct CSR.');
if (hasValue(err)) {
Expand Down

0 comments on commit 3c93777

Please sign in to comment.