Skip to content

Commit 2c7252c

Browse files
authored
Merge pull request #18591 from github/fix-sentry-hydro-error
fix: sentry hydro errors
2 parents b559b1c + 548a436 commit 2c7252c

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

middleware/events.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,17 @@ router.post('/', async function postEvents (req, res, next) {
4444
throw err
4545
}
4646

47+
if (res.headersSent) {
48+
throw new Error('Cannot send http response: Hydro publish succeeded, but took too long.')
49+
}
50+
4751
return res.status(201).json(fields)
4852
} catch (err) {
4953
if (isDev) console.error(err)
50-
return res.status(502).json({})
54+
55+
if (!res.headersSent) {
56+
return res.status(502).json({})
57+
}
5158
}
5259
})
5360

0 commit comments

Comments
 (0)