From 3555e96ce3750a8d6b93cf0caa4668eccedffab5 Mon Sep 17 00:00:00 2001 From: Julien Nahum Date: Wed, 17 Jan 2024 19:32:17 +0100 Subject: [PATCH] Added sentry --- client/nuxt.config.ts | 14 +- client/package-lock.json | 342 +++++++++++++++++++++++++++++++-------- client/package.json | 3 +- client/plugins/sentry.js | 64 ++++++++ client/runtimeConfig.js | 7 +- 5 files changed, 361 insertions(+), 69 deletions(-) create mode 100644 client/plugins/sentry.js diff --git a/client/nuxt.config.ts b/client/nuxt.config.ts index eade9c7..16bdfaf 100644 --- a/client/nuxt.config.ts +++ b/client/nuxt.config.ts @@ -1,6 +1,6 @@ // https://nuxt.com/docs/api/configuration/nuxt-config import runtimeConfig from "./runtimeConfig"; -import opnformConfig from "./opnform.config"; +import { sentryVitePlugin } from "@sentry/vite-plugin"; import sitemap from "./sitemap"; export default defineNuxtConfig({ @@ -15,7 +15,6 @@ export default defineNuxtConfig({ 'nuxt-simple-sitemap', '@nuxt/image', ... process.env.NUXT_PUBLIC_GOOGLE_ANALYTICS_CODE ? ['nuxt-gtag'] : [], - ... process.env.NUXT_PUBLIC_SENTRY_DSN ? ['@nuxtjs/sentry'] : [], ], build: { transpile: ["vue-notion", "query-builder-vue-3"], @@ -68,6 +67,17 @@ export default defineNuxtConfig({ image: { quality: 95, }, + sourcemap: true, + vite: { + plugins: [ + // Put the Sentry vite plugin after all other plugins + sentryVitePlugin({ + authToken: process.env.SENTRY_AUTH_TOKEN, + org: "opnform", + project: "opnform-vue", + }), + ], + }, sitemap, runtimeConfig }) diff --git a/client/package-lock.json b/client/package-lock.json index 7167fed..6c3ef18 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -10,8 +10,9 @@ "@codemirror/lang-html": "^6.4.7", "@hcaptcha/vue3-hcaptcha": "^1.3.0", "@nuxt/image": "^1.1.0", - "@nuxtjs/sentry": "^8.0.6", "@pinia/nuxt": "^0.5.1", + "@sentry/vite-plugin": "^2.10.2", + "@sentry/vue": "^7.93.0", "@tailwindcss/aspect-ratio": "^0.4.2", "@vueuse/components": "^10.5.0", "@vueuse/core": "^10.5.0", @@ -2165,25 +2166,6 @@ "pathe": "^1.1.1" } }, - "node_modules/@nuxtjs/sentry": { - "version": "8.0.6", - "resolved": "https://registry.npmjs.org/@nuxtjs/sentry/-/sentry-8.0.6.tgz", - "integrity": "sha512-hovyal4XrdPEr7wtiUTt8vrm1eB23UYU2Yb/Sqwx8SPqnwOoUTkeVOB0IoL0johMOjtFt5c7GpfGsJ8iGhU+8A==", - "dependencies": { - "@sentry/core": "^7.81.1", - "@sentry/integrations": "^7.81.1", - "@sentry/node": "^7.81.1", - "@sentry/utils": "^7.81.1", - "@sentry/vue": "^7.81.1", - "consola": "^3.2.3", - "defu": "^6.1.2", - "hash-sum": "^2.0.0", - "jiti": "^1.20.0", - "lodash.mergewith": "^4.6.2", - "mlly": "^1.4.2", - "pathe": "^1.1.1" - } - }, "node_modules/@parcel/watcher": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.4.0.tgz", @@ -2908,6 +2890,240 @@ "node": ">=8" } }, + "node_modules/@sentry/bundler-plugin-core": { + "version": "2.10.2", + "resolved": "https://registry.npmjs.org/@sentry/bundler-plugin-core/-/bundler-plugin-core-2.10.2.tgz", + "integrity": "sha512-7IoekLtROlJZqTxtHQ3IhocBuf9dsEq+JjqlHMyZXoq+QKuvJFvMd/4T+r6KjZ15kMZOIkR+spK3V7duH201hw==", + "dependencies": { + "@sentry/cli": "^2.22.3", + "@sentry/node": "^7.60.0", + "@sentry/utils": "^7.60.0", + "dotenv": "^16.3.1", + "find-up": "5.0.0", + "glob": "9.3.2", + "magic-string": "0.27.0", + "unplugin": "1.0.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@sentry/bundler-plugin-core/node_modules/glob": { + "version": "9.3.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-9.3.2.tgz", + "integrity": "sha512-BTv/JhKXFEHsErMte/AnfiSv8yYOLLiyH2lTg8vn02O21zWFgHPTfxtgn1QRe7NRgggUhC8hacR2Re94svHqeA==", + "dependencies": { + "fs.realpath": "^1.0.0", + "minimatch": "^7.4.1", + "minipass": "^4.2.4", + "path-scurry": "^1.6.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@sentry/bundler-plugin-core/node_modules/magic-string": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz", + "integrity": "sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.13" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@sentry/bundler-plugin-core/node_modules/minimatch": { + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-7.4.6.tgz", + "integrity": "sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@sentry/bundler-plugin-core/node_modules/minipass": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.8.tgz", + "integrity": "sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/bundler-plugin-core/node_modules/unplugin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.0.1.tgz", + "integrity": "sha512-aqrHaVBWW1JVKBHmGo33T5TxeL0qWzfvjWokObHA9bYmN7eNDkwOxmLjhioHl9878qDFMAaT51XNroRyuz7WxA==", + "dependencies": { + "acorn": "^8.8.1", + "chokidar": "^3.5.3", + "webpack-sources": "^3.2.3", + "webpack-virtual-modules": "^0.5.0" + } + }, + "node_modules/@sentry/bundler-plugin-core/node_modules/webpack-virtual-modules": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.5.0.tgz", + "integrity": "sha512-kyDivFZ7ZM0BVOUteVbDFhlRt7Ah/CSPwJdi8hBpkK7QLumUqdLtVfm/PX/hkcnrvr0i77fO5+TjZ94Pe+C9iw==" + }, + "node_modules/@sentry/cli": { + "version": "2.25.2", + "resolved": "https://registry.npmjs.org/@sentry/cli/-/cli-2.25.2.tgz", + "integrity": "sha512-lgt1QPaCfs/QZNXwyw3gvuBR2/CLwFSdU/oT7Bpxwizz8XVXhlKS98zJF1UVCy7SecsDSoOI0Z+B+X658cpquQ==", + "hasInstallScript": true, + "dependencies": { + "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" + }, + "bin": { + "sentry-cli": "bin/sentry-cli" + }, + "engines": { + "node": ">= 10" + }, + "optionalDependencies": { + "@sentry/cli-darwin": "2.25.2", + "@sentry/cli-linux-arm": "2.25.2", + "@sentry/cli-linux-arm64": "2.25.2", + "@sentry/cli-linux-i686": "2.25.2", + "@sentry/cli-linux-x64": "2.25.2", + "@sentry/cli-win32-i686": "2.25.2", + "@sentry/cli-win32-x64": "2.25.2" + } + }, + "node_modules/@sentry/cli-darwin": { + "version": "2.25.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-darwin/-/cli-darwin-2.25.2.tgz", + "integrity": "sha512-o1d5NnVUrc1dxDm56k7Co8tSTcOuxbApdxweVXXsiq20HblZCyIi7WxxRkAg4RfKx594sKGiw9uCVvECi+9UpA==", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-arm": { + "version": "2.25.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm/-/cli-linux-arm-2.25.2.tgz", + "integrity": "sha512-n398jd87Ymejt5k/6RjCEjXAvntOWuqhBDANxzhgr5/9FzbODJ844g1mOpcxiIlduzKSzWlPbTEKQulMp2Mt4w==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux", + "freebsd" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-arm64": { + "version": "2.25.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.25.2.tgz", + "integrity": "sha512-lm5jaigV6xu9Gwo0wNk+bX6yVkl5k3gNXcSXcKCISFo+Teb7Zhf9IyXANPm4VY2DdiZAjPJt8gS1bu+Mn7irtQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux", + "freebsd" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-i686": { + "version": "2.25.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-i686/-/cli-linux-i686-2.25.2.tgz", + "integrity": "sha512-/YYx2gfqO5mkxyBgFcnDbZzkZ2+2xNarwrqWcqq3Qw0XlO9DWAQB2G+twV1RW/UfSU6fFIWErn94efh2EWmyzQ==", + "cpu": [ + "x86", + "ia32" + ], + "optional": true, + "os": [ + "linux", + "freebsd" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-x64": { + "version": "2.25.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-x64/-/cli-linux-x64-2.25.2.tgz", + "integrity": "sha512-rRafqy84R5mYA4JEfNsUeN10af5euJnK7fgqYM0mJIaplHC2YEXT9aUYWoryWPZiYqmdNUhsA6lX7iynSW9pZw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux", + "freebsd" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-win32-i686": { + "version": "2.25.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-win32-i686/-/cli-win32-i686-2.25.2.tgz", + "integrity": "sha512-plT/gi41F+67g9AwrEm4avRXnjCtHCcnRnJ6zPu/iINGap8mvYQJSU/qM0oGwV6hRGg3JJN66XIvJPIuIs8P8w==", + "cpu": [ + "x86", + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-win32-x64": { + "version": "2.25.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-win32-x64/-/cli-win32-x64-2.25.2.tgz", + "integrity": "sha512-Mb6mAyPi9gIfpzF5MTk0JXgFP9nxka3Fb7JYn6AY4RW++sOjapkTrcXL2Gp3ZfQkWj5rFTgln4+eNmZPsD2gzA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@sentry/core": { "version": "7.93.0", "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.93.0.tgz", @@ -2920,20 +3136,6 @@ "node": ">=8" } }, - "node_modules/@sentry/integrations": { - "version": "7.93.0", - "resolved": "https://registry.npmjs.org/@sentry/integrations/-/integrations-7.93.0.tgz", - "integrity": "sha512-uGQ8+DiqUr6SbhdJJHyIqDJ6kHnFuSv8nZWtj2tJ1I8q8u8MX8t8Om6R/R4ap45gCkWg/zqZq7B+gQV6TYewjQ==", - "dependencies": { - "@sentry/core": "7.93.0", - "@sentry/types": "7.93.0", - "@sentry/utils": "7.93.0", - "localforage": "^1.8.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/@sentry/node": { "version": "7.93.0", "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.93.0.tgz", @@ -2982,6 +3184,34 @@ "node": ">=8" } }, + "node_modules/@sentry/vite-plugin": { + "version": "2.10.2", + "resolved": "https://registry.npmjs.org/@sentry/vite-plugin/-/vite-plugin-2.10.2.tgz", + "integrity": "sha512-30uu0L8ZCpAKOxAXmtyqwL06sG8UEBXGY5mxUDITyQYDf8pKuiOEf5018KlEDjhYVypfMQH3jq5xXUUka+/ipg==", + "dependencies": { + "@sentry/bundler-plugin-core": "2.10.2", + "unplugin": "1.0.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@sentry/vite-plugin/node_modules/unplugin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.0.1.tgz", + "integrity": "sha512-aqrHaVBWW1JVKBHmGo33T5TxeL0qWzfvjWokObHA9bYmN7eNDkwOxmLjhioHl9878qDFMAaT51XNroRyuz7WxA==", + "dependencies": { + "acorn": "^8.8.1", + "chokidar": "^3.5.3", + "webpack-sources": "^3.2.3", + "webpack-virtual-modules": "^0.5.0" + } + }, + "node_modules/@sentry/vite-plugin/node_modules/webpack-virtual-modules": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.5.0.tgz", + "integrity": "sha512-kyDivFZ7ZM0BVOUteVbDFhlRt7Ah/CSPwJdi8hBpkK7QLumUqdLtVfm/PX/hkcnrvr0i77fO5+TjZ94Pe+C9iw==" + }, "node_modules/@sentry/vue": { "version": "7.93.0", "resolved": "https://registry.npmjs.org/@sentry/vue/-/vue-7.93.0.tgz", @@ -6365,7 +6595,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" @@ -7060,11 +7289,6 @@ "resolved": "https://registry.npmjs.org/image-meta/-/image-meta-0.2.0.tgz", "integrity": "sha512-ZBGjl0ZMEMeOC3Ns0wUF/5UdUmr3qQhBSCniT0LxOgGGIRHiNFOkMtIHB7EOznRU47V2AxPgiVP+s+0/UCU0Hg==" }, - "node_modules/immediate": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" - }, "node_modules/immutable": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.4.tgz", @@ -7707,14 +7931,6 @@ "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.53.tgz", "integrity": "sha512-sDTnnqlWK4vH4AlDQuswz3n4Hx7bIQWTpIcScJX+Sp7St3LXHmfiax/ZFfyYxHmkdCvydOLSuvtAO/XpXiSySw==" }, - "node_modules/lie": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", - "integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==", - "dependencies": { - "immediate": "~3.0.5" - } - }, "node_modules/lilconfig": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.0.0.tgz", @@ -7781,19 +7997,10 @@ "url": "https://github.com/sponsors/antfu" } }, - "node_modules/localforage": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz", - "integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==", - "dependencies": { - "lie": "3.1.1" - } - }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, "dependencies": { "p-locate": "^5.0.0" }, @@ -7835,11 +8042,6 @@ "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==" }, - "node_modules/lodash.mergewith": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", - "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==" - }, "node_modules/lodash.pick": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz", @@ -9210,7 +9412,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, "dependencies": { "yocto-queue": "^0.1.0" }, @@ -9225,7 +9426,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, "dependencies": { "p-limit": "^3.0.2" }, @@ -10152,6 +10352,14 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", @@ -10186,6 +10394,11 @@ "resolved": "https://registry.npmjs.org/protocols/-/protocols-2.0.1.tgz", "integrity": "sha512-/XJ368cyBJ7fzLMwLKv1e4vLxOju2MNAIokcr7meSaNcVbWz/CPcW22cP04mwxOErdA5mwjA8Q6w/cdAQxVn7Q==" }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -13440,7 +13653,6 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, "engines": { "node": ">=10" }, diff --git a/client/package.json b/client/package.json index 92aa151..cb61afc 100644 --- a/client/package.json +++ b/client/package.json @@ -25,8 +25,9 @@ "@codemirror/lang-html": "^6.4.7", "@hcaptcha/vue3-hcaptcha": "^1.3.0", "@nuxt/image": "^1.1.0", - "@nuxtjs/sentry": "^8.0.6", "@pinia/nuxt": "^0.5.1", + "@sentry/vite-plugin": "^2.10.2", + "@sentry/vue": "^7.93.0", "@tailwindcss/aspect-ratio": "^0.4.2", "@vueuse/components": "^10.5.0", "@vueuse/core": "^10.5.0", diff --git a/client/plugins/sentry.js b/client/plugins/sentry.js new file mode 100644 index 0000000..221d452 --- /dev/null +++ b/client/plugins/sentry.js @@ -0,0 +1,64 @@ +import * as Sentry from "@sentry/vue"; + +async function lazyLoadSentryIntegrations() { + // don't load on server + if (!process.client) return; + + const {Replay} = await import("@sentry/vue"); + Sentry.addIntegration(new Replay({ + maskAllText: false, + blockAllMedia: false, + })); +} + +function getSentryIntegrations() { + // don't load on server + if (!process.client) return []; + + const router = useRouter(); + const browserTracing = new Sentry.BrowserTracing({ + routingInstrumentation: Sentry.vueRouterInstrumentation(router), + }); + + return [browserTracing]; +} + + +export default defineNuxtPlugin({ + name: 'sentry', + parallel: true, + async setup(nuxtApp) { + const vueApp = nuxtApp.vueApp; + + const config = useRuntimeConfig(); + + Sentry.init({ + app: vueApp, + dsn: config.public.SENTRY_DSN_PUBLIC ?? null, + integrations: getSentryIntegrations(), + + // Set tracesSampleRate to 1.0 to capture 100% + // of transactions for performance monitoring. + // We recommend adjusting this value in production + tracesSampleRate: config.public.SENTRY_TRACES_SAMPLE_RATE, + + // Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled + // tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/], + + // This sets the sample rate. You may want this to be 100% while + // in development and sample at a lower rate in production + replaysSessionSampleRate: config.public.SENTRY_REPLAY_SAMPLE_RATE, + + // If the entire session is not sampled, use the below sample rate to sample + // sessions when an error occurs. + replaysOnErrorSampleRate: config.public.SENTRY_ERROR_REPLAY_SAMPLE_RATE, + + beforeSend(event) { + return event; + }, + }) + + // Lazy-load the replay integration to reduce bundle size + lazyLoadSentryIntegrations() + } +}); diff --git a/client/runtimeConfig.js b/client/runtimeConfig.js index 7cb4b21..fcf808e 100644 --- a/client/runtimeConfig.js +++ b/client/runtimeConfig.js @@ -7,12 +7,17 @@ export default { hCaptchaSiteKey: process.env.NUXT_PUBLIC_H_CAPTCHA_SITE_KEY || null, googleAnalyticsCode: process.env.NUXT_PUBLIC_GOOGLE_ANALYTICS_CODE || null, amplitudeCode: process.env.NUXT_PUBLIC_AMPLITUDE_CODE || null, - sentryDsn: process.env.NUXT_PUBLIC_SENTRY_DSN || null, crispWebsiteId: process.env.NUXT_PUBLIC_CRISP_WEBSITE_ID || null, aiFeaturesEnabled: process.env.NUXT_PUBLIC_AI_FEATURES_ENABLED || false, s3Enabled: process.env.NUXT_PUBLIC_S3_ENABLED || false, paidPlansEnabled: process.env.NUXT_PUBLIC_PAID_PLANS_ENABLED || false, customDomainsEnabled: process.env.NUXT_PUBLIC_CUSTOM_DOMAINS_ENABLED || false, + + // Config within public will be also exposed to the client + SENTRY_DSN_PUBLIC: process.env.SENTRY_DSN_PUBLIC, + SENTRY_TRACES_SAMPLE_RATE: parseFloat(process.env.SENTRY_TRACES_SAMPLE_RATE ?? '0'), + SENTRY_REPLAY_SAMPLE_RATE: parseFloat(process.env.SENTRY_REPLAY_SAMPLE_RATE ?? '0'), + SENTRY_ERROR_REPLAY_SAMPLE_RATE: parseFloat(process.env.SENTRY_ERROR_REPLAY_SAMPLE_RATE ?? '0'), }, /**