diff --git a/.env.example b/.env.example index 942b22fc..91210a7f 100644 --- a/.env.example +++ b/.env.example @@ -7,3 +7,5 @@ SESSION_SECRET= # For social login see docs/auth.md # See docs/rewriter.md how to configure the workflow rewriting HADDOCK3_NCORES = 6 +# Error tracking, See https://glitchtip.com/ or https://sentry.io/ for more information +SENTRY_DSN= diff --git a/app/entry.server.tsx b/app/entry.server.tsx index ef87d7ab..97ff3f6f 100644 --- a/app/entry.server.tsx +++ b/app/entry.server.tsx @@ -16,6 +16,7 @@ import { createReadableStreamFromReadable } from "@remix-run/node"; import { RemixServer } from "@remix-run/react"; import { isbot } from "isbot"; import { renderToPipeableStream } from "react-dom/server"; +import { init as SentryInit, captureException } from "@sentry/node"; const ABORT_DELAY = 5_000; @@ -144,11 +145,13 @@ function handleBrowserRequest( }); } +SentryInit({ dsn: process.env.SENTRY_DSN }); + export function handleError( error: unknown, { request }: LoaderFunctionArgs | ActionFunctionArgs ) { if (!request.signal.aborted) { - // TODO send error to reporting service + captureException(error); } } diff --git a/app/root.tsx b/app/root.tsx index 8d7580d5..b4e75e79 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -86,7 +86,7 @@ function BoundaryShell({ return ( - Haddock3 - {title} + {`Haddock3 - ${title}`} diff --git a/package-lock.json b/package-lock.json index ccd8b575..49145314 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@remix-run/node": "^2.5.1", "@remix-run/react": "^2.5.1", "@remix-run/serve": "^2.5.1", + "@sentry/node": "^7.99.0", "bcryptjs": "^2.4.3", "d3-dsv": "^3.0.1", "isbot": "^4.1.0", @@ -2707,6 +2708,64 @@ "win32" ] }, + "node_modules/@sentry-internal/tracing": { + "version": "7.99.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.99.0.tgz", + "integrity": "sha512-z3JQhHjoM1KdM20qrHwRClKJrNLr2CcKtCluq7xevLtXHJWNAQQbafnWD+Aoj85EWXBzKt9yJMv2ltcXJ+at+w==", + "dependencies": { + "@sentry/core": "7.99.0", + "@sentry/types": "7.99.0", + "@sentry/utils": "7.99.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/core": { + "version": "7.99.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.99.0.tgz", + "integrity": "sha512-vOAtzcAXEUtS/oW7wi3wMkZ3hsb5Ch96gKyrrj/mXdOp2zrcwdNV6N9/pawq2E9P/7Pw8AXw4CeDZztZrjQLuA==", + "dependencies": { + "@sentry/types": "7.99.0", + "@sentry/utils": "7.99.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/node": { + "version": "7.99.0", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.99.0.tgz", + "integrity": "sha512-34wYtLddnPcQ8qvKq62AfxowaMFw+GMUZGv7fIs9FxeBqqqn6Ckl0gFCTADudIIBQ3rSbmN7sHJIXdyiQv+pcw==", + "dependencies": { + "@sentry-internal/tracing": "7.99.0", + "@sentry/core": "7.99.0", + "@sentry/types": "7.99.0", + "@sentry/utils": "7.99.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/types": { + "version": "7.99.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.99.0.tgz", + "integrity": "sha512-94qwOw4w40sAs5mCmzcGyj8ZUu/KhnWnuMZARRq96k+SjRW/tHFAOlIdnFSrt3BLPvSOK7R3bVAskZQ0N4FTmA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/utils": { + "version": "7.99.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.99.0.tgz", + "integrity": "sha512-cYZy5WNTkWs5GgggGnjfGqC44CWir0pAv4GVVSx0fsup4D4pMKBJPrtub15f9uC+QkUf3vVkqwpBqeFxtmJQTQ==", + "dependencies": { + "@sentry/types": "7.99.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", diff --git a/package.json b/package.json index 877b5ee9..9c21fa95 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "@remix-run/node": "^2.5.1", "@remix-run/react": "^2.5.1", "@remix-run/serve": "^2.5.1", + "@sentry/node": "^7.99.0", "bcryptjs": "^2.4.3", "d3-dsv": "^3.0.1", "isbot": "^4.1.0",