Commit f5edfebc authored by Alexey Boklin's avatar Alexey Boklin Committed by Luis Fernando Alvarez D

Docs: Fix comments in with-sentry example (server.js) (#8125)

parent 68e3223c
......@@ -27,7 +27,7 @@ function sessionCookie (req, res, next) {
}
const sourcemapsForSentryOnly = token => (req, res, next) => {
// In production we only want to serve source maps for sentry
// In production we only want to serve source maps for Sentry
if (!dev && !!token && req.headers['x-sentry-token'] !== token) {
res
.status(401)
......@@ -38,19 +38,18 @@ const sourcemapsForSentryOnly = token => (req, res, next) => {
}
app.prepare().then(() => {
// The app.buildId is only available after app.prepare(), hence why we setup
// here.
// app.buildId is only available after app.prepare(), hence why we setup here
const { Sentry } = require('./utils/sentry')(app.buildId)
express()
// This attaches request information to sentry errors
// This attaches request information to Sentry errors
.use(Sentry.Handlers.requestHandler())
.use(cookieParser())
.use(sessionCookie)
.get(/\.map$/, sourcemapsForSentryOnly(process.env.SENTRY_TOKEN))
// Regular next.js request handler
.use(handler)
// This handles errors if they are thrown before raching the app
// This handles errors if they are thrown before reaching the app
.use(Sentry.Handlers.errorHandler())
.listen(port, err => {
if (err) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment