Skip to content

Commit

Permalink
added sentry server error capture
Browse files Browse the repository at this point in the history
  • Loading branch information
jgentes committed Dec 30, 2023
1 parent 258462e commit 2f7d9d4
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 72 deletions.
10 changes: 9 additions & 1 deletion app/entry.server.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import { type EntryContext } from '@remix-run/cloudflare'
import { RemixServer } from '@remix-run/react'
import * as Sentry from '@sentry/remix'
import { renderHeadToString } from 'remix-island'
import { Head } from './root'

import { renderToReadableStream } from 'react-dom/server'

Sentry.init({
dsn: 'https://6ea05bb5dd89aae9f5695090ecbee8bc@o4506276018192384.ingest.sentry.io/4506276020092928',
tracesSampleRate: 0.1
})

export const handleError = Sentry.wrapRemixHandleError;

export default function handleRequest(
request: Request,
responseStatusCode: number,
Expand Down Expand Up @@ -74,4 +82,4 @@ async function handleBrowserRequest(
headers: responseHeaders,
status: didError ? 500 : responseStatusCode
})
}
}
5 changes: 4 additions & 1 deletion app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
useLocation
} from '@remix-run/react'
import * as Sentry from '@sentry/browser'
import { withSentry } from '@sentry/remix'
import { createBrowserClient } from '@supabase/ssr'
import { SupabaseClient } from '@supabase/supabase-js'
import { ThemeProvider as NextThemesProvider } from 'next-themes'
Expand Down Expand Up @@ -162,4 +163,6 @@ const App = ({ error }: { error?: string }) => {
)
}

export { App as default, links, meta, ErrorBoundary }
const AppWithSentry = withSentry(App)

export { AppWithSentry as default, links, meta, ErrorBoundary }
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@remix-run/cloudflare": "^2.4.0",
"@remix-run/cloudflare-pages": "^2.4.0",
"@remix-run/react": "^2.4.0",
"@sentry/remix": "^7.81.1",
"@sentry/remix": "^7.91.0",
"@supabase/auth-ui-react": "^0.4.6",
"@supabase/ssr": "^0.0.10",
"@supabase/supabase-js": "^2.38.4",
Expand Down
221 changes: 152 additions & 69 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3731,92 +3731,175 @@ __metadata:
languageName: node
linkType: hard

"@sentry-internal/tracing@npm:7.81.1":
version: 7.81.1
resolution: "@sentry-internal/tracing@npm:7.81.1"
"@sentry-internal/feedback@npm:7.91.0":
version: 7.91.0
resolution: "@sentry-internal/feedback@npm:7.91.0"
dependencies:
"@sentry/core": 7.81.1
"@sentry/types": 7.81.1
"@sentry/utils": 7.81.1
checksum: 7a92250ff6216b9c4ad15f5b2e21f5acc9ced71f704bfabfec76d05e8787ab69fa4ee46805eb7bcbb3ee0288cdb98a0489877f7ab65cc491b47fccbe76248681
"@sentry/core": 7.91.0
"@sentry/types": 7.91.0
"@sentry/utils": 7.91.0
checksum: 91ae9095e6c8193f9fef7bcec902c53a9ba14e1dd755a22ec3e129264b4155a36aef4acd7b71d7de54441929099c0d8de941d5489c9e1c32263f3421fc1c9ef3
languageName: node
linkType: hard

"@sentry/browser@npm:7.81.1":
version: 7.81.1
resolution: "@sentry/browser@npm:7.81.1"
"@sentry-internal/tracing@npm:7.91.0":
version: 7.91.0
resolution: "@sentry-internal/tracing@npm:7.91.0"
dependencies:
"@sentry-internal/tracing": 7.81.1
"@sentry/core": 7.81.1
"@sentry/replay": 7.81.1
"@sentry/types": 7.81.1
"@sentry/utils": 7.81.1
checksum: 5f7ae47f35c9e5cc7e8e6cd97f96adb40612f146024b83465930ce1f31c9a27f63d0735a014b73d4febfb4215736cb98583d5caa440d80754c5701634d905eee
"@sentry/core": 7.91.0
"@sentry/types": 7.91.0
"@sentry/utils": 7.91.0
checksum: 2097dedbaa7a138fe7125b60545fcc115d9de0adaa97f35a1fd9ea28a30b915c6a0d9d1a69c6d7f7616708241004152676752178efa15e39eb971732457acae5
languageName: node
linkType: hard

"@sentry/cli@npm:^2.21.2":
version: 2.21.5
resolution: "@sentry/cli@npm:2.21.5"
"@sentry/browser@npm:7.91.0":
version: 7.91.0
resolution: "@sentry/browser@npm:7.91.0"
dependencies:
"@sentry-internal/feedback": 7.91.0
"@sentry-internal/tracing": 7.91.0
"@sentry/core": 7.91.0
"@sentry/replay": 7.91.0
"@sentry/types": 7.91.0
"@sentry/utils": 7.91.0
checksum: 5b8134374575bcefc73910e99471f4bde442ba800b7fa2d02b0633d795707d0fa74a918212aa7d093bc81e0cc3865aac2fe3e6be5e721001036f588c8ad30695
languageName: node
linkType: hard

"@sentry/cli-darwin@npm:2.23.1":
version: 2.23.1
resolution: "@sentry/cli-darwin@npm:2.23.1"
conditions: os=darwin
languageName: node
linkType: hard

"@sentry/cli-linux-arm64@npm:2.23.1":
version: 2.23.1
resolution: "@sentry/cli-linux-arm64@npm:2.23.1"
conditions: (os=linux | os=freebsd) & cpu=arm64
languageName: node
linkType: hard

"@sentry/cli-linux-arm@npm:2.23.1":
version: 2.23.1
resolution: "@sentry/cli-linux-arm@npm:2.23.1"
conditions: (os=linux | os=freebsd) & cpu=arm
languageName: node
linkType: hard

"@sentry/cli-linux-i686@npm:2.23.1":
version: 2.23.1
resolution: "@sentry/cli-linux-i686@npm:2.23.1"
conditions: (os=linux | os=freebsd) & (cpu=x86 | cpu=ia32)
languageName: node
linkType: hard

"@sentry/cli-linux-x64@npm:2.23.1":
version: 2.23.1
resolution: "@sentry/cli-linux-x64@npm:2.23.1"
conditions: (os=linux | os=freebsd) & cpu=x64
languageName: node
linkType: hard

"@sentry/cli-win32-i686@npm:2.23.1":
version: 2.23.1
resolution: "@sentry/cli-win32-i686@npm:2.23.1"
conditions: os=win32 & (cpu=x86 | cpu=ia32)
languageName: node
linkType: hard

"@sentry/cli-win32-x64@npm:2.23.1":
version: 2.23.1
resolution: "@sentry/cli-win32-x64@npm:2.23.1"
conditions: os=win32 & cpu=x64
languageName: node
linkType: hard

"@sentry/cli@npm:^2.23.0":
version: 2.23.1
resolution: "@sentry/cli@npm:2.23.1"
dependencies:
"@sentry/cli-darwin": 2.23.1
"@sentry/cli-linux-arm": 2.23.1
"@sentry/cli-linux-arm64": 2.23.1
"@sentry/cli-linux-i686": 2.23.1
"@sentry/cli-linux-x64": 2.23.1
"@sentry/cli-win32-i686": 2.23.1
"@sentry/cli-win32-x64": 2.23.1
https-proxy-agent: ^5.0.0
node-fetch: ^2.6.7
progress: ^2.0.3
proxy-from-env: ^1.1.0
which: ^2.0.2
dependenciesMeta:
"@sentry/cli-darwin":
optional: true
"@sentry/cli-linux-arm":
optional: true
"@sentry/cli-linux-arm64":
optional: true
"@sentry/cli-linux-i686":
optional: true
"@sentry/cli-linux-x64":
optional: true
"@sentry/cli-win32-i686":
optional: true
"@sentry/cli-win32-x64":
optional: true
bin:
sentry-cli: bin/sentry-cli
checksum: a91387f730e0ba34783ad1331edfff32c305d3c615c35f70564028a455f6567c4c648cc537191238bff4c2696b6f314cefdaee1459ea4c1f7cab6f3040978007
checksum: ec23dbac3360552dcb60b2762e6e653f20dc208e49f9d7e8496933c8a3916afda4562e5b8ead2ec42b339501895629b23ce9634835681727fa2e9c5048f0baf5
languageName: node
linkType: hard

"@sentry/core@npm:7.81.1":
version: 7.81.1
resolution: "@sentry/core@npm:7.81.1"
"@sentry/core@npm:7.91.0":
version: 7.91.0
resolution: "@sentry/core@npm:7.91.0"
dependencies:
"@sentry/types": 7.81.1
"@sentry/utils": 7.81.1
checksum: 9f78797fc612b28b438a3fa72a9cd3c34c90094f322d7a3a0dcb6cb6aea0c222bc4a09a3c444dd399f53601e9d22ee695dfb383be196a18b5168b76312960a25
"@sentry/types": 7.91.0
"@sentry/utils": 7.91.0
checksum: 5a284c1b1f88ed8d642578cce293c91a0979f533db156fcccb8cae68d1d426a14730e6b06d993a69a1d640b988481c6451dcffe8812c6bc3e23fc8bce5c04dc0
languageName: node
linkType: hard

"@sentry/node@npm:7.81.1":
version: 7.81.1
resolution: "@sentry/node@npm:7.81.1"
"@sentry/node@npm:7.91.0":
version: 7.91.0
resolution: "@sentry/node@npm:7.91.0"
dependencies:
"@sentry-internal/tracing": 7.81.1
"@sentry/core": 7.81.1
"@sentry/types": 7.81.1
"@sentry/utils": 7.81.1
"@sentry-internal/tracing": 7.91.0
"@sentry/core": 7.91.0
"@sentry/types": 7.91.0
"@sentry/utils": 7.91.0
https-proxy-agent: ^5.0.0
checksum: 45ab4e7c4e6b1fd2649a98c36c9ecb91199406ba15e36265cf8e26b9e976f257bd847f7d0b1da8c58711293ddc6a021b3ffdf56698b822126763284cf732215b
checksum: 49971e47aa29b8232f5c13d613dbe9a651da11146813b88b4a8038f7f3b8ae44d98603e784f47c616d303e77d3f22257cfd1ac86f0a8d960f89ba0d51a69d42a
languageName: node
linkType: hard

"@sentry/react@npm:7.81.1":
version: 7.81.1
resolution: "@sentry/react@npm:7.81.1"
"@sentry/react@npm:7.91.0":
version: 7.91.0
resolution: "@sentry/react@npm:7.91.0"
dependencies:
"@sentry/browser": 7.81.1
"@sentry/types": 7.81.1
"@sentry/utils": 7.81.1
"@sentry/browser": 7.91.0
"@sentry/types": 7.91.0
"@sentry/utils": 7.91.0
hoist-non-react-statics: ^3.3.2
peerDependencies:
react: 15.x || 16.x || 17.x || 18.x
checksum: a24b33975f6531c1f9eef7b4e32097c1a0e40dc41cc1e8b97f3ca3d485d9d7f7b4e95cf3156ed03490d059d75ca79091fadc904a0b867361abb0e39eca3df531
checksum: 75d2a9d05e07abf4c0da839677221a24954ae9883cea5521319de5f4e6067e2ff84b8ef82ee6d20707989f970329856f3918bfba55fc486bc9457f5c50e0d4e1
languageName: node
linkType: hard

"@sentry/remix@npm:^7.81.1":
version: 7.81.1
resolution: "@sentry/remix@npm:7.81.1"
"@sentry/remix@npm:^7.91.0":
version: 7.91.0
resolution: "@sentry/remix@npm:7.91.0"
dependencies:
"@sentry/cli": ^2.21.2
"@sentry/core": 7.81.1
"@sentry/node": 7.81.1
"@sentry/react": 7.81.1
"@sentry/types": 7.81.1
"@sentry/utils": 7.81.1
"@sentry/cli": ^2.23.0
"@sentry/core": 7.91.0
"@sentry/node": 7.91.0
"@sentry/react": 7.91.0
"@sentry/types": 7.91.0
"@sentry/utils": 7.91.0
glob: ^10.3.4
yargs: ^17.6.0
peerDependencies:
Expand All @@ -3825,35 +3908,35 @@ __metadata:
react: 16.x || 17.x || 18.x
bin:
sentry-upload-sourcemaps: scripts/sentry-upload-sourcemaps.js
checksum: e9d6fe3e43a13ed1a2bbfce18cc3ea35df12ce090cf9ace029fd6eaa24b9c6f719544fd3b9c821438f92a06a0b05a613fc1e532a160e5481706644743815a9b3
checksum: 57526b3bb1dedef69d7f4593b371d4b88d6d137f30358c214b4110a96902c21798b15e2ee5f7589aa93e97770fd3697614d4eb18a07d4820d89a057a873f840b
languageName: node
linkType: hard

"@sentry/replay@npm:7.81.1":
version: 7.81.1
resolution: "@sentry/replay@npm:7.81.1"
"@sentry/replay@npm:7.91.0":
version: 7.91.0
resolution: "@sentry/replay@npm:7.91.0"
dependencies:
"@sentry-internal/tracing": 7.81.1
"@sentry/core": 7.81.1
"@sentry/types": 7.81.1
"@sentry/utils": 7.81.1
checksum: ae8eb01844d0fb636cb614eb66ffcb738624f67f661c4f23efcec1af47f9627bf4a84c26d74c978a447002b2fd57bd8a56f8d0e8c2d70bd08179b12dbfab6fdd
"@sentry-internal/tracing": 7.91.0
"@sentry/core": 7.91.0
"@sentry/types": 7.91.0
"@sentry/utils": 7.91.0
checksum: 66cd1217b1a179f413b4ff40f55683628ffc02a638b176d97d6bf081466519eff4e823fa35741ec608f34066c2cf7a3663b681752f161389a951950ac5b8c5d2
languageName: node
linkType: hard

"@sentry/types@npm:7.81.1":
version: 7.81.1
resolution: "@sentry/types@npm:7.81.1"
checksum: a3e07ee66a6e75b24837d540a7ec46ac0207f0b948f008d950d5f2619821623ddf1a904d2c2bc59a458b117183ab82e51702fab2ae79f7edb96b6c490f89a731
"@sentry/types@npm:7.91.0":
version: 7.91.0
resolution: "@sentry/types@npm:7.91.0"
checksum: a0b8853b1257e860e823d4907fbe53914083891fe82699bccf9669342575b01ff663350d300784a0987e56adeb6c9902b1c3012cb957015b56570676c55bf291
languageName: node
linkType: hard

"@sentry/utils@npm:7.81.1":
version: 7.81.1
resolution: "@sentry/utils@npm:7.81.1"
"@sentry/utils@npm:7.91.0":
version: 7.91.0
resolution: "@sentry/utils@npm:7.91.0"
dependencies:
"@sentry/types": 7.81.1
checksum: c22256122f01147facd7b7728e5ab969f1ec24e207ba59fd9a59cf98fc12b6ffea90a70071b20b54858473cb4f66c9aa5eafa2a6fbfcb82a0f0a0e653a2b3548
"@sentry/types": 7.91.0
checksum: 79a9ae4193fc42c2fff8b7808958170164966410149101526da923233cef5f741ab8953842544e7481155e0f3a828ebf2a6b040f30d03945b603377036eece58
languageName: node
linkType: hard

Expand Down Expand Up @@ -7974,7 +8057,7 @@ isbot@latest:
"@remix-run/cloudflare-pages": ^2.4.0
"@remix-run/dev": ^2.4.0
"@remix-run/react": ^2.4.0
"@sentry/remix": ^7.81.1
"@sentry/remix": ^7.91.0
"@supabase/auth-ui-react": ^0.4.6
"@supabase/ssr": ^0.0.10
"@supabase/supabase-js": ^2.38.4
Expand Down

0 comments on commit 2f7d9d4

Please sign in to comment.