diff --git a/frontend/package.json b/frontend/package.json index e8ac4c0..c2fff9d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -38,6 +38,7 @@ "type": "module", "dependencies": { "@popperjs/core": "^2.11.6", + "@sentry/node": "^7.43.0", "base64-arraybuffer": "^1.0.2", "bootstrap": "5.3.0-alpha1", "bootstrap-icons": "^1.10.3", diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index 6dc6966..4d41fc5 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -2,6 +2,7 @@ lockfileVersion: 5.4 specifiers: '@popperjs/core': ^2.11.6 + '@sentry/node': ^7.43.0 '@sveltejs/adapter-auto': ^2.0.0 '@sveltejs/adapter-node': ^1.2.2 '@sveltejs/kit': ^1.5.0 @@ -33,6 +34,7 @@ specifiers: dependencies: '@popperjs/core': 2.11.6 + '@sentry/node': 7.43.0 base64-arraybuffer: 1.0.2 bootstrap: 5.3.0-alpha1_@popperjs+core@2.11.6 bootstrap-icons: 1.10.3 @@ -415,6 +417,43 @@ packages: rollup: 3.18.0 dev: true + /@sentry/core/7.43.0: + resolution: {integrity: sha512-zvMZgEi7ptLBwDnd+xR/u4zdSe5UzS4S3ZhoemdQrn1PxsaVySD/ptyzLoGSZEABqlRxGHnQrZ78MU1hUDvKuQ==} + engines: {node: '>=8'} + dependencies: + '@sentry/types': 7.43.0 + '@sentry/utils': 7.43.0 + tslib: 1.14.1 + dev: false + + /@sentry/node/7.43.0: + resolution: {integrity: sha512-oXaTBq6Bk8Qwsd46hhRU2MLEnjYqWI41nPJmXyAWkDSYQTP7sUe1qM8bCUdsRpPwQh955Vq9qCRfgMbN4lEoAQ==} + engines: {node: '>=8'} + dependencies: + '@sentry/core': 7.43.0 + '@sentry/types': 7.43.0 + '@sentry/utils': 7.43.0 + cookie: 0.4.2 + https-proxy-agent: 5.0.1 + lru_map: 0.3.3 + tslib: 1.14.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@sentry/types/7.43.0: + resolution: {integrity: sha512-5XxCWqYWJNoS+P6Ie2ZpUDxLRCt7FTEzmlQkCdjW6MFWOX26hAbF/wEuOTYAFKZXMIXOz0Egofik1e8v1Cg6/A==} + engines: {node: '>=8'} + dev: false + + /@sentry/utils/7.43.0: + resolution: {integrity: sha512-f78YfMLcgNU7+suyWFCuQhQlneXXMS+egb0EFZh7iU7kANUPRX5T4b+0C+fwaPm5gA6XfGYskr4ZnzQJLOlSqg==} + engines: {node: '>=8'} + dependencies: + '@sentry/types': 7.43.0 + tslib: 1.14.1 + dev: false + /@sveltejs/adapter-auto/2.0.0_@sveltejs+kit@1.11.0: resolution: {integrity: sha512-b+gkHFZgD771kgV3aO4avHFd7y1zhmMYy9i6xOK7m/rwmwaRO8gnF5zBc0Rgca80B2PMU1bKNxyBTHA14OzUAQ==} peerDependencies: @@ -708,6 +747,15 @@ packages: hasBin: true dev: true + /agent-base/6.0.2: + resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} + engines: {node: '>= 6.0.0'} + dependencies: + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: false + /ajv/6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} dependencies: @@ -895,6 +943,11 @@ packages: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} dev: true + /cookie/0.4.2: + resolution: {integrity: sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==} + engines: {node: '>= 0.6'} + dev: false + /cookie/0.5.0: resolution: {integrity: sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==} engines: {node: '>= 0.6'} @@ -925,7 +978,6 @@ packages: optional: true dependencies: ms: 2.1.2 - dev: true /deep-is/0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} @@ -1378,6 +1430,16 @@ packages: domutils: 3.0.1 entities: 4.4.0 + /https-proxy-agent/5.0.1: + resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} + engines: {node: '>= 6'} + dependencies: + agent-base: 6.0.2 + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: false + /ignore/5.2.4: resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} engines: {node: '>= 4'} @@ -1539,6 +1601,10 @@ packages: yallist: 4.0.0 dev: true + /lru_map/0.3.3: + resolution: {integrity: sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ==} + dev: false + /magic-string/0.27.0: resolution: {integrity: sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==} engines: {node: '>=12'} @@ -1631,7 +1697,6 @@ packages: /ms/2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} - dev: true /nanoid/3.3.4: resolution: {integrity: sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==} @@ -2204,7 +2269,6 @@ packages: /tslib/1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} - dev: true /tslib/2.5.0: resolution: {integrity: sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==} diff --git a/frontend/src/hooks.server.ts b/frontend/src/hooks.server.ts new file mode 100644 index 0000000..2fa16c8 --- /dev/null +++ b/frontend/src/hooks.server.ts @@ -0,0 +1,17 @@ +import { PRIVATE_SENTRY_DSN } from "$env/static/private"; +import * as Sentry from "@sentry/node"; +import type { HandleServerError } from "@sveltejs/kit"; + +Sentry.init({ dsn: PRIVATE_SENTRY_DSN }); + +export const handleError = (({ error, event }) => { + console.log(error); + console.log(event); + const id = Sentry.captureException(error); + + return { + message: "Internal server error", + code: 500, + id, + }; +}) satisfies HandleServerError;