Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
f5edfebc
Commit
f5edfebc
authored
Jul 26, 2019
by
Alexey Boklin
Committed by
Luis Fernando Alvarez D
Jul 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docs: Fix comments in with-sentry example (server.js) (#8125)
parent
68e3223c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
server.js
examples/with-sentry/server.js
+4
-5
No files found.
examples/with-sentry/server.js
View file @
f5edfebc
...
@@ -27,7 +27,7 @@ function sessionCookie (req, res, next) {
...
@@ -27,7 +27,7 @@ function sessionCookie (req, res, next) {
}
}
const
sourcemapsForSentryOnly
=
token
=>
(
req
,
res
,
next
)
=>
{
const
sourcemapsForSentryOnly
=
token
=>
(
req
,
res
,
next
)
=>
{
// In production we only want to serve source maps for
s
entry
// In production we only want to serve source maps for
S
entry
if
(
!
dev
&&
!!
token
&&
req
.
headers
[
'x-sentry-token'
]
!==
token
)
{
if
(
!
dev
&&
!!
token
&&
req
.
headers
[
'x-sentry-token'
]
!==
token
)
{
res
res
.
status
(
401
)
.
status
(
401
)
...
@@ -38,19 +38,18 @@ const sourcemapsForSentryOnly = token => (req, res, next) => {
...
@@ -38,19 +38,18 @@ const sourcemapsForSentryOnly = token => (req, res, next) => {
}
}
app
.
prepare
().
then
(()
=>
{
app
.
prepare
().
then
(()
=>
{
// The app.buildId is only available after app.prepare(), hence why we setup
// app.buildId is only available after app.prepare(), hence why we setup here
// here.
const
{
Sentry
}
=
require
(
'./utils/sentry'
)(
app
.
buildId
)
const
{
Sentry
}
=
require
(
'./utils/sentry'
)(
app
.
buildId
)
express
()
express
()
// This attaches request information to
s
entry errors
// This attaches request information to
S
entry errors
.
use
(
Sentry
.
Handlers
.
requestHandler
())
.
use
(
Sentry
.
Handlers
.
requestHandler
())
.
use
(
cookieParser
())
.
use
(
cookieParser
())
.
use
(
sessionCookie
)
.
use
(
sessionCookie
)
.
get
(
/
\.
map$/
,
sourcemapsForSentryOnly
(
process
.
env
.
SENTRY_TOKEN
))
.
get
(
/
\.
map$/
,
sourcemapsForSentryOnly
(
process
.
env
.
SENTRY_TOKEN
))
// Regular next.js request handler
// Regular next.js request handler
.
use
(
handler
)
.
use
(
handler
)
// This handles errors if they are thrown before raching the app
// This handles errors if they are thrown before r
e
aching the app
.
use
(
Sentry
.
Handlers
.
errorHandler
())
.
use
(
Sentry
.
Handlers
.
errorHandler
())
.
listen
(
port
,
err
=>
{
.
listen
(
port
,
err
=>
{
if
(
err
)
{
if
(
err
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment