From a238ad35f5f69e96f8d081b39b332938710c7a6e Mon Sep 17 00:00:00 2001 From: Valentyne Stigloher Date: Mon, 19 Feb 2024 22:24:08 +0100 Subject: [PATCH 1/9] (ops) log server version to trace deployments in logs --- nuxt.config.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nuxt.config.ts b/nuxt.config.ts index 305fa984f..95144fccb 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -485,6 +485,12 @@ const nuxtConfig: NuxtConfig = { }); }, }, + listen(_server, { port }) { + if (version) { + process.stderr.write(`[${new Date().toISOString()}] ` + + `Listening on port ${port} with version ${version}`); + } + }, }, }; From c0c83270d055b26ea8b896b1186553ce33e8695a Mon Sep 17 00:00:00 2001 From: Valentyne Stigloher Date: Mon, 19 Feb 2024 22:33:14 +0100 Subject: [PATCH 2/9] (refactor) nuxtConfig.plugins use mode instead of deprecated ssr --- nuxt.config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nuxt.config.ts b/nuxt.config.ts index 95144fccb..d9f520526 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -169,8 +169,8 @@ const nuxtConfig: NuxtConfig = { { src: '~/plugins/axios.js' }, { src: '~/plugins/globals.ts' }, { src: '~/plugins/auth.ts' }, - { src: '~/plugins/datepicker.js', ssr: false }, - { src: '~/plugins/track.js', ssr: false }, + { src: '~/plugins/datepicker.js', mode: 'client' }, + { src: '~/plugins/track.js', mode: 'client' }, { src: '~/plugins/browserDetect.js' }, ], components: true, From c36705efcbaf75c9ca079df47a779ca85b3c2891 Mon Sep 17 00:00:00 2001 From: Valentyne Stigloher Date: Mon, 19 Feb 2024 23:35:43 +0100 Subject: [PATCH 3/9] (sentry) use @nuxt/sentry to setup sentry requires that the following environment variable is set: SENTRY_DSN={sentry dsn} --- .env.dist | 2 + nuxt.config.ts | 6 ++ package.json | 1 + server/index.ts | 6 ++ tsconfig.json | 1 + yarn.lock | 184 +++++++++++++++++++++++++++++++++++++++++++++++- 6 files changed, 199 insertions(+), 1 deletion(-) diff --git a/.env.dist b/.env.dist index 1852a66af..5efee2d84 100644 --- a/.env.dist +++ b/.env.dist @@ -29,6 +29,8 @@ AWS_CLOUDFRONT_ID= TURNSTILE_SITEKEY=1x00000000000000000000AA TURNSTILE_SECRET=1x0000000000000000000000000000000AA +SENTRY_DSN= + TWITTER_CALENDAR_CONSUMER_KEY= TWITTER_CALENDAR_CONSUMER_SECRET= TWITTER_CALENDAR_ACCESS_TOKEN_KEY= diff --git a/nuxt.config.ts b/nuxt.config.ts index d9f520526..a6a825a69 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -189,6 +189,7 @@ const nuxtConfig: NuxtConfig = { ['@nuxtjs/redirect-module', { rules: config.redirects, }], + '@nuxtjs/sentry', 'cookie-universal-nuxt', 'vue-plausible', ], @@ -217,6 +218,11 @@ const nuxtConfig: NuxtConfig = { // - tecc enableAutoPageviews: false, }, + sentry: { + tracing: { + tracesSampleRate: 0.1, + }, + }, publicRuntimeConfig: { ...config, plausible: { diff --git a/package.json b/package.json index 617c3a10c..4dfdafc97 100644 --- a/package.json +++ b/package.json @@ -83,6 +83,7 @@ "@fortawesome/fontawesome-pro": "git+ssh://git@gitlab.com:Avris/FontAwesomePro.git", "@nuxt/types": "2.17.2", "@nuxt/typescript-build": "^3.0.2", + "@nuxtjs/sentry": "^8.0.7", "@stylistic/eslint-plugin": "^1.5.4", "@types/autoprefixer": "^10.2.0", "@types/cookie-parser": "^1.4.6", diff --git a/server/index.ts b/server/index.ts index b8ae36f01..03044e0e3 100644 --- a/server/index.ts +++ b/server/index.ts @@ -2,6 +2,7 @@ import '../src/dotenv.js'; import express from 'express'; import type { Request, Response, NextFunction } from 'express'; +import * as Sentry from '@sentry/node'; import authenticate from '../src/authenticate.ts'; import dbConnection from './db.ts'; import type { Database, SQLQuery } from './db.ts'; @@ -45,6 +46,9 @@ const MemoryStore = memorystore(session); const app = express(); app.enable('trust proxy'); +app.use(Sentry.Handlers.requestHandler()); +app.use(Sentry.Handlers.tracingHandler()); + app.use(express.json({ verify: (req, res, buf) => { if (buf.includes(Buffer.from('narodowcy.net', 'utf-8'))) { @@ -152,6 +156,8 @@ app.use(calendarRoute); app.use(translationsRoute); app.use(subscriptionRoute); +app.use(Sentry.Handlers.errorHandler()); + app.use((err: unknown, req: Request, res: Response, _next: NextFunction) => { console.error(formatError(err, req)); res.status(500).send('Unexpected server error'); diff --git a/tsconfig.json b/tsconfig.json index acd5b67b3..7e6c3eb51 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,6 +19,7 @@ "types": [ "@nuxt/types", "@nuxt/typescript-build", + "@nuxtjs/sentry", "@types/node" ] }, diff --git a/yarn.lock b/yarn.lock index cf2888807..39fce8dda 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2309,6 +2309,24 @@ resolved "https://registry.yarnpkg.com/@nuxtjs/redirect-module/-/redirect-module-0.3.1.tgz#90a6986882337401cb0576cdf9479d4e3b552cce" integrity sha512-yL2unrYfUSqs+4cUtkQvEQMsuTeCOlQd+Y5sTqMZzWBadF8h01tCVDG95zmOTNIiCupb+sQho2Tixwl1f826aw== +"@nuxtjs/sentry@^8.0.7": + version "8.0.7" + resolved "https://registry.yarnpkg.com/@nuxtjs/sentry/-/sentry-8.0.7.tgz#46c5cc5d43a652e7afb1b5ba6c3bdbb148be9bde" + integrity sha512-i+j7dYuoDAanQdS18/zFlrGj5qVIVUKWWy4jcrEtkr8wV15+es0oWDvdlEMtMBWgDHdh9AKste0XOjNgtBx/9A== + dependencies: + "@sentry/core" "^7.100.0" + "@sentry/integrations" "^7.100.0" + "@sentry/node" "^7.100.0" + "@sentry/utils" "^7.100.0" + "@sentry/vue" "^7.100.0" + consola "^3.2.3" + defu "^6.1.4" + hash-sum "^2.0.0" + jiti "^1.21.0" + lodash.mergewith "^4.6.2" + mlly "^1.5.0" + pathe "^1.1.2" + "@nuxtjs/youch@^4.2.3": version "4.2.3" resolved "https://registry.yarnpkg.com/@nuxtjs/youch/-/youch-4.2.3.tgz#36f8b22df5a0efaa81373109851e1d857aca6bed" @@ -2331,6 +2349,107 @@ cookie-parser "^1.4.5" csurf "^1.11.0" +"@sentry-internal/feedback@7.105.0": + version "7.105.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/feedback/-/feedback-7.105.0.tgz#f2a25b55e5368509cfd540c21e74503568492057" + integrity sha512-17doUQFKYgLfG7EmZXjZQ7HR/aBzuLDd+GVaCNthUPyiz/tltV7EFECDWwHpXqzQgYRgroSbY8PruMVujFGUUw== + dependencies: + "@sentry/core" "7.105.0" + "@sentry/types" "7.105.0" + "@sentry/utils" "7.105.0" + +"@sentry-internal/replay-canvas@7.105.0": + version "7.105.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/replay-canvas/-/replay-canvas-7.105.0.tgz#fed7d67d976837ef7c1b72a6db461179703fa6f5" + integrity sha512-XMBdkjIDhap5Gwrub5wlUJhuUVJM4aL4lZV8KcxJZZSXgXsnyGYbEh9SPZOHO05jtbxTxVeL3Pik5qtYjdGnPA== + dependencies: + "@sentry/core" "7.105.0" + "@sentry/replay" "7.105.0" + "@sentry/types" "7.105.0" + "@sentry/utils" "7.105.0" + +"@sentry-internal/tracing@7.105.0": + version "7.105.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/tracing/-/tracing-7.105.0.tgz#9cb06f8281454343215cfe4b119c8198f032ec72" + integrity sha512-b+AFYB7Bc9vmyxl2jbmuT4esX5G0oPfpz35A0sxFzmJIhvMg1YMDNio2c81BtKN+VSPORCnKMLhfk3kyKKvWMQ== + dependencies: + "@sentry/core" "7.105.0" + "@sentry/types" "7.105.0" + "@sentry/utils" "7.105.0" + +"@sentry/browser@7.105.0": + version "7.105.0" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.105.0.tgz#3eb56785cfc1cf58528b29ea954b73093e6f9481" + integrity sha512-OlYJzsZG109T1VpZ7O7KXf9IXCUUpp41lkkQM7ICBOBsfiHRUKmV5piTGCG5UgAvyb/gI/I1uQQtO4jthcHKEA== + dependencies: + "@sentry-internal/feedback" "7.105.0" + "@sentry-internal/replay-canvas" "7.105.0" + "@sentry-internal/tracing" "7.105.0" + "@sentry/core" "7.105.0" + "@sentry/replay" "7.105.0" + "@sentry/types" "7.105.0" + "@sentry/utils" "7.105.0" + +"@sentry/core@7.105.0", "@sentry/core@^7.100.0": + version "7.105.0" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.105.0.tgz#89db519dd9aa7326de63a7eaccf861de3769ab1c" + integrity sha512-5xsaTG6jZincTeJUmZomlv20mVRZUEF1U/g89lmrSOybyk2+opEnB1JeBn4ODwnvmSik8r2QLr6/RiYlaxRJCg== + dependencies: + "@sentry/types" "7.105.0" + "@sentry/utils" "7.105.0" + +"@sentry/integrations@^7.100.0": + version "7.105.0" + resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-7.105.0.tgz#8953bd310d8681f9a29f918269b98640ab302abe" + integrity sha512-AgzecTkF0o+C4svbroMGA+cW5LRnfFSoJnzF5ltUB67hnX906amlwbOvdkKD3MugYO02nRSjF/eEi26E1HACMA== + dependencies: + "@sentry/core" "7.105.0" + "@sentry/types" "7.105.0" + "@sentry/utils" "7.105.0" + localforage "^1.8.1" + +"@sentry/node@^7.100.0": + version "7.105.0" + resolved "https://registry.yarnpkg.com/@sentry/node/-/node-7.105.0.tgz#cfe8e5602dff2cc754a95412f44c9ca8156422ff" + integrity sha512-b0QwZ7vT4hcJi6LmNRh3dcaYpLtXnkYXkL0rfhMb8hN8sUx8zuOWFMI7j0cfAloVThUeJVwGyv9dERfzGS2r2w== + dependencies: + "@sentry-internal/tracing" "7.105.0" + "@sentry/core" "7.105.0" + "@sentry/types" "7.105.0" + "@sentry/utils" "7.105.0" + +"@sentry/replay@7.105.0": + version "7.105.0" + resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.105.0.tgz#61784e3e88afa66a0d9b1b9d222153ab54ea4bd0" + integrity sha512-hZD2m6fNL9gorUOaaEpqxeH7zNP4y2Ej0TdieM1HMQ2q9Zrm9yOzk9/7ALfbRLIZFRMFTqo9vvVztLs3E+Hx+g== + dependencies: + "@sentry-internal/tracing" "7.105.0" + "@sentry/core" "7.105.0" + "@sentry/types" "7.105.0" + "@sentry/utils" "7.105.0" + +"@sentry/types@7.105.0": + version "7.105.0" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.105.0.tgz#51dadb7ad650e883459acf18df2ecbb5b4b6e5c2" + integrity sha512-80o0KMVM+X2Ym9hoQxvJetkJJwkpCg7o6tHHFXI+Rp7fawc2iCMTa0IRQMUiSkFvntQLYIdDoNNuKdzz2PbQGA== + +"@sentry/utils@7.105.0", "@sentry/utils@^7.100.0": + version "7.105.0" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.105.0.tgz#727187d252b97cb9e6c78bcdd0e9a1d14e60f313" + integrity sha512-YVAV0c2KLM8+VZCicQ/E/P2+J9Vs0hGhrXwV7w6ZEAtvxrg4oF270toL1WRhvcaf8JO4J1v4V+LuU6Txs4uEeQ== + dependencies: + "@sentry/types" "7.105.0" + +"@sentry/vue@^7.100.0": + version "7.105.0" + resolved "https://registry.yarnpkg.com/@sentry/vue/-/vue-7.105.0.tgz#37655b96db8acb65309d8462d8c3d26cf000932d" + integrity sha512-QWUWAwCFruw75aqsExHKZ9HWtFyFRo4+8UsCiXUWeMpcpQu+mZ4VzHbTxNBZKmSTA0jYa/tTpYXkfI5ozM+y4A== + dependencies: + "@sentry/browser" "7.105.0" + "@sentry/core" "7.105.0" + "@sentry/types" "7.105.0" + "@sentry/utils" "7.105.0" + "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" @@ -5576,6 +5695,11 @@ defu@^6.0.0, defu@^6.1.2: resolved "https://registry.yarnpkg.com/defu/-/defu-6.1.2.tgz#1217cba167410a1765ba93893c6dbac9ed9d9e5c" integrity sha512-+uO4+qr7msjNNWKYPHqN/3+Dx3NFkmIzayk2L1MyZQlvgZb/J1A0fo410dpKrN2SnqFjt8n4JL8fDJE0wIgjFQ== +defu@^6.1.4: + version "6.1.4" + resolved "https://registry.yarnpkg.com/defu/-/defu-6.1.4.tgz#4e0c9cf9ff68fe5f3d7f2765cc1a012dfdcb0479" + integrity sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg== + delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" @@ -7837,6 +7961,11 @@ ignore@^5.2.0, ignore@^5.2.4: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== +immediate@~3.0.5: + version "3.0.6" + resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" + integrity sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ== + import-fresh@^3.1.0, import-fresh@^3.2.1: version "3.3.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" @@ -8797,7 +8926,7 @@ jiti@^1.16.2: resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.19.3.tgz#ef554f76465b3c2b222dc077834a71f0d4a37569" integrity sha512-5eEbBDQT/jF1xg6l36P+mWGGoH9Spuy0PCdSr2dtWRDGC6ph/w9ZCL4lmESW8f8F7MwT3XKescfP0wnZWAKL9w== -jiti@^1.20.0: +jiti@^1.20.0, jiti@^1.21.0: version "1.21.0" resolved "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz#7c97f8fe045724e136a397f7340475244156105d" integrity sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q== @@ -8946,6 +9075,11 @@ jsonc-eslint-parser@^2.0.4: espree "^9.0.0" semver "^7.3.5" +jsonc-parser@^3.2.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.1.tgz#031904571ccf929d7670ee8c547545081cb37f1a" + integrity sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA== + jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" @@ -9115,6 +9249,13 @@ levn@^0.4.1: prelude-ls "^1.2.1" type-check "~0.4.0" +lie@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lie/-/lie-3.1.1.tgz#9a436b2cc7746ca59de7a41fa469b3efb76bd87e" + integrity sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw== + dependencies: + immediate "~3.0.5" + lilconfig@^2.0.3, lilconfig@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.1.0.tgz#78e23ac89ebb7e1bfbf25b18043de756548e7f52" @@ -9171,6 +9312,13 @@ loader-utils@^2.0.0, loader-utils@^2.0.4: emojis-list "^3.0.0" json5 "^2.1.2" +localforage@^1.8.1: + version "1.10.0" + resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.10.0.tgz#5c465dc5f62b2807c3a84c0c6a1b1b3212781dd4" + integrity sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg== + dependencies: + lie "3.1.1" + locate-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" @@ -9253,6 +9401,11 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== +lodash.mergewith@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz#617121f89ac55f59047c7aec1ccd6654c6590f55" + integrity sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ== + lodash.once@^4.0.0: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac" @@ -9821,6 +9974,16 @@ mkdirp@^1.0.3, mkdirp@^1.0.4: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== +mlly@^1.2.0, mlly@^1.5.0: + version "1.6.1" + resolved "https://registry.yarnpkg.com/mlly/-/mlly-1.6.1.tgz#0983067dc3366d6314fc5e12712884e6978d028f" + integrity sha512-vLgaHvaeunuOXHSmEbZ9izxPx3USsk8KCQ8iC+aTlp5sKRSoZvwhHh5L9VbKSaVC6sJDqbyohIS76E2VmHIPAA== + dependencies: + acorn "^8.11.3" + pathe "^1.1.2" + pkg-types "^1.0.3" + ufo "^1.3.2" + modify-filename@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/modify-filename/-/modify-filename-1.1.0.tgz#9a2dec83806fbb2d975f22beec859ca26b393aa1" @@ -10704,6 +10867,11 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== +pathe@^1.1.0, pathe@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/pathe/-/pathe-1.1.2.tgz#6c4cb47a945692e48a1ddd6e4094d170516437ec" + integrity sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ== + pbkdf2@^3.0.3: version "3.1.2" resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075" @@ -10791,6 +10959,15 @@ pkg-dir@^4.1.0, pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" +pkg-types@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/pkg-types/-/pkg-types-1.0.3.tgz#988b42ab19254c01614d13f4f65a2cfc7880f868" + integrity sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A== + dependencies: + jsonc-parser "^3.2.0" + mlly "^1.2.0" + pathe "^1.1.0" + "plausible-api@https://github.com/avo7/plausible-api.git#main": version "1.0.1" resolved "https://github.com/avo7/plausible-api.git#0bb79ad1d26754a71b3ec1351255dbf5a32e6e2a" @@ -13819,6 +13996,11 @@ ufo@^1.3.1: resolved "https://registry.npmjs.org/ufo/-/ufo-1.3.2.tgz#c7d719d0628a1c80c006d2240e0d169f6e3c0496" integrity sha512-o+ORpgGwaYQXgqGDwd+hkS4PuZ3QnmqMMxRuajK/a38L6fTpcE5GPIfrf+L/KemFzfUpeUQc1rRS1iDBozvnFA== +ufo@^1.3.2: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ufo/-/ufo-1.4.0.tgz#39845b31be81b4f319ab1d99fd20c56cac528d32" + integrity sha512-Hhy+BhRBleFjpJ2vchUNN40qgkh0366FWJGqVLYBHev0vpHTrXSA0ryT+74UiW6KWsldNurQMKGqCm1M2zBciQ== + uglify-js@^3.5.1: version "3.17.4" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.4.tgz#61678cf5fa3f5b7eb789bb345df29afb8257c22c" From f1b6d86cb2e5875f1d1dc30b57c42cb77d3443c3 Mon Sep 17 00:00:00 2001 From: Valentyne Stigloher Date: Fri, 23 Feb 2024 21:44:23 +0100 Subject: [PATCH 4/9] (sentry) enable source-map uploading with release management requires that the following environment variables are set: SENTRY_PUBLISH_RELEASE=true SENTRY_AUTH_TOKEN={generated token} SENTRY_ORG=pronouns-page SENTRY_PROJECT=pronouns-page --- .env.dist | 4 + README.md | 8 +- nuxt.config.ts | 3 + package.json | 1 + yarn.lock | 330 +++++++++++++++++++++++++++++++++++++++++++------ 5 files changed, 309 insertions(+), 37 deletions(-) diff --git a/.env.dist b/.env.dist index 5efee2d84..3fecdcc30 100644 --- a/.env.dist +++ b/.env.dist @@ -30,6 +30,10 @@ TURNSTILE_SITEKEY=1x00000000000000000000AA TURNSTILE_SECRET=1x0000000000000000000000000000000AA SENTRY_DSN= +SENTRY_PUBLISH_RELEASE=false +SENTRY_AUTH_TOKEN= +SENTRY_ORG=pronouns-page +SENTRY_PROJECT=pronouns-page TWITTER_CALENDAR_CONSUMER_KEY= TWITTER_CALENDAR_CONSUMER_SECRET= diff --git a/README.md b/README.md index 267f600f9..2e60106b9 100644 --- a/README.md +++ b/README.md @@ -167,13 +167,19 @@ For small changes, you can ask to have your branch deployed on a test server. #### Emails -By default, emails will be displayed in stdout without being sent. +When using `NODE_ENV=development`, emails will be displayed in stdout without being sent. It's not in an easily readable format, but for many cases good enough. If you want to actually see the message in a mail client, you need to specify `MAILER_TRANSPORT` to use any provider you want (on production SMTP via AWS is used). Remember to also set `MAILER_OVERWRITE` to your own address – this way you won't accidentally send anything out to random addresses. +### Sentry + +To enable sentry, you have to set the corresponding environment variables. +Remember that releases will not be published for development builds, +so to test them, you have to build a production build (`make deploy` and `nuxt start`, both with `NODE_ENV=development`). + ### Troubleshooting #### Hot Module Replacement in Nuxt development mode diff --git a/nuxt.config.ts b/nuxt.config.ts index a6a825a69..2b4299366 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -222,6 +222,9 @@ const nuxtConfig: NuxtConfig = { tracing: { tracesSampleRate: 0.1, }, + publishRelease: { + telemetry: false, + }, }, publicRuntimeConfig: { ...config, diff --git a/package.json b/package.json index 4dfdafc97..08899d50e 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,7 @@ "@nuxt/types": "2.17.2", "@nuxt/typescript-build": "^3.0.2", "@nuxtjs/sentry": "^8.0.7", + "@sentry/webpack-plugin": "^2.14.2", "@stylistic/eslint-plugin": "^1.5.4", "@types/autoprefixer": "^10.2.0", "@types/cookie-parser": "^1.4.6", diff --git a/yarn.lock b/yarn.lock index 39fce8dda..ed09b0e04 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,6 +7,14 @@ resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== +"@ampproject/remapping@^2.1.0": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4" + integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw== + dependencies: + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.24" + "@ampproject/remapping@^2.2.0": version "2.2.1" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630" @@ -23,7 +31,7 @@ "@babel/highlight" "^7.22.10" chalk "^2.4.2" -"@babel/code-frame@^7.12.13", "@babel/code-frame@^7.22.13", "@babel/code-frame@^7.23.5", "@babel/code-frame@^7.8.3": +"@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.7", "@babel/code-frame@^7.22.13", "@babel/code-frame@^7.23.5", "@babel/code-frame@^7.8.3": version "7.23.5" resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz#9009b69a8c602293476ad598ff53e4562e15c244" integrity sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA== @@ -41,6 +49,27 @@ resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz#ffb878728bb6bdcb6f4510aa51b1be9afb8cfd98" integrity sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw== +"@babel/core@7.18.5": + version "7.18.5" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.18.5.tgz#c597fa680e58d571c28dda9827669c78cdd7f000" + integrity sha512-MGY8vg3DxMnctw0LdvSEojOsumc70g0t18gNyUdAZqB1Rpd1Bqo/svHGvt+UJ6JcGX+DIekGFDxxIWofBxLCnQ== + dependencies: + "@ampproject/remapping" "^2.1.0" + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.18.2" + "@babel/helper-compilation-targets" "^7.18.2" + "@babel/helper-module-transforms" "^7.18.0" + "@babel/helpers" "^7.18.2" + "@babel/parser" "^7.18.5" + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.18.5" + "@babel/types" "^7.18.4" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.1" + semver "^6.3.0" + "@babel/core@^7.11.6", "@babel/core@^7.12.3": version "7.23.6" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.23.6.tgz#8be77cd77c55baadcc1eae1c33df90ab6d2151d4" @@ -83,6 +112,16 @@ json5 "^2.2.3" semver "^6.3.1" +"@babel/generator@^7.18.2", "@babel/generator@^7.23.6", "@babel/generator@^7.7.2": + version "7.23.6" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.6.tgz#9e1fca4811c77a10580d17d26b57b036133f3c2e" + integrity sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw== + dependencies: + "@babel/types" "^7.23.6" + "@jridgewell/gen-mapping" "^0.3.2" + "@jridgewell/trace-mapping" "^0.3.17" + jsesc "^2.5.1" + "@babel/generator@^7.23.5": version "7.23.5" resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.23.5.tgz#17d0a1ea6b62f351d281350a5f80b87a810c4755" @@ -93,16 +132,6 @@ "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" -"@babel/generator@^7.23.6", "@babel/generator@^7.7.2": - version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.6.tgz#9e1fca4811c77a10580d17d26b57b036133f3c2e" - integrity sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw== - dependencies: - "@babel/types" "^7.23.6" - "@jridgewell/gen-mapping" "^0.3.2" - "@jridgewell/trace-mapping" "^0.3.17" - jsesc "^2.5.1" - "@babel/helper-annotate-as-pure@^7.18.6", "@babel/helper-annotate-as-pure@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.22.5.tgz#e7f06737b197d580a01edf75d97e2c8be99d3882" @@ -117,6 +146,17 @@ dependencies: "@babel/types" "^7.22.15" +"@babel/helper-compilation-targets@^7.18.2", "@babel/helper-compilation-targets@^7.23.6": + version "7.23.6" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz#4d79069b16cbcf1461289eccfbbd81501ae39991" + integrity sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ== + dependencies: + "@babel/compat-data" "^7.23.5" + "@babel/helper-validator-option" "^7.23.5" + browserslist "^4.22.2" + lru-cache "^5.1.1" + semver "^6.3.1" + "@babel/helper-compilation-targets@^7.22.15": version "7.22.15" resolved "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz#0698fc44551a26cf29f18d4662d5bf545a6cfc52" @@ -139,17 +179,6 @@ lru-cache "^5.1.1" semver "^6.3.1" -"@babel/helper-compilation-targets@^7.23.6": - version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz#4d79069b16cbcf1461289eccfbbd81501ae39991" - integrity sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ== - dependencies: - "@babel/compat-data" "^7.23.5" - "@babel/helper-validator-option" "^7.23.5" - browserslist "^4.22.2" - lru-cache "^5.1.1" - semver "^6.3.1" - "@babel/helper-create-class-features-plugin@^7.18.6", "@babel/helper-create-class-features-plugin@^7.21.0": version "7.22.10" resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.22.10.tgz#dd2612d59eac45588021ac3d6fa976d08f4e95a3" @@ -270,7 +299,7 @@ dependencies: "@babel/types" "^7.22.15" -"@babel/helper-module-transforms@^7.23.3": +"@babel/helper-module-transforms@^7.18.0", "@babel/helper-module-transforms@^7.23.3": version "7.23.3" resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz#d7d12c3c5d30af5b3c0fcab2a6d5217773e2d0f1" integrity sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ== @@ -380,6 +409,15 @@ "@babel/template" "^7.22.15" "@babel/types" "^7.22.19" +"@babel/helpers@^7.18.2": + version "7.24.0" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.24.0.tgz#a3dd462b41769c95db8091e49cfe019389a9409b" + integrity sha512-ulDZdc0Aj5uLc5nETsa7EPx2L7rM0YJM8r7ck7U73AXi7qOV44IHHRAYZHY6iU1rr3C5N4NtTmMRUJP6kwCWeA== + dependencies: + "@babel/template" "^7.24.0" + "@babel/traverse" "^7.24.0" + "@babel/types" "^7.24.0" + "@babel/helpers@^7.23.5": version "7.23.5" resolved "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.5.tgz#52f522840df8f1a848d06ea6a79b79eefa72401e" @@ -426,6 +464,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.10.tgz#e37634f9a12a1716136c44624ef54283cabd3f55" integrity sha512-lNbdGsQb9ekfsnjFGhEiF4hfFqGgfOP3H3d27re3n+CGhNuTSUEQdfWk556sTLNTloczcdM5TYF2LhzmDQKyvQ== +"@babel/parser@^7.18.5", "@babel/parser@^7.24.0": + version "7.24.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.0.tgz#26a3d1ff49031c53a97d03b604375f028746a9ac" + integrity sha512-QuP/FxEAzMSjXygs8v4N9dvdXzEHN4W1oF3PxuWAtPo08UdM17u89RDMgjLn/mlc56iM0HlLmVkO/wgR+rDgHg== + "@babel/parser@^7.22.15", "@babel/parser@^7.23.5": version "7.23.5" resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.23.5.tgz#37dee97c4752af148e1d38c34b856b2507660563" @@ -1190,6 +1233,15 @@ dependencies: regenerator-runtime "^0.14.0" +"@babel/template@^7.16.7", "@babel/template@^7.24.0": + version "7.24.0" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.24.0.tgz#c6a524aa93a4a05d66aaf31654258fae69d87d50" + integrity sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA== + dependencies: + "@babel/code-frame" "^7.23.5" + "@babel/parser" "^7.24.0" + "@babel/types" "^7.24.0" + "@babel/template@^7.22.15", "@babel/template@^7.3.3": version "7.22.15" resolved "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" @@ -1208,6 +1260,22 @@ "@babel/parser" "^7.22.5" "@babel/types" "^7.22.5" +"@babel/traverse@^7.18.5", "@babel/traverse@^7.24.0": + version "7.24.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.0.tgz#4a408fbf364ff73135c714a2ab46a5eab2831b1e" + integrity sha512-HfuJlI8qq3dEDmNU5ChzzpZRWq+oxCZQyMzIMEqLho+AQnhMnKQUzH6ydo3RBl/YjPCuk68Y6s0Gx0AeyULiWw== + dependencies: + "@babel/code-frame" "^7.23.5" + "@babel/generator" "^7.23.6" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-hoist-variables" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/parser" "^7.24.0" + "@babel/types" "^7.24.0" + debug "^4.3.1" + globals "^11.1.0" + "@babel/traverse@^7.23.5": version "7.23.5" resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.5.tgz#f546bf9aba9ef2b042c0e00d245990c15508e7ec" @@ -1249,6 +1317,15 @@ "@babel/helper-validator-identifier" "^7.22.20" to-fast-properties "^2.0.0" +"@babel/types@^7.18.4", "@babel/types@^7.24.0": + version "7.24.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.0.tgz#3b951f435a92e7333eba05b7566fd297960ea1bf" + integrity sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w== + dependencies: + "@babel/helper-string-parser" "^7.23.4" + "@babel/helper-validator-identifier" "^7.22.20" + to-fast-properties "^2.0.0" + "@babel/types@^7.22.15", "@babel/types@^7.22.19", "@babel/types@^7.23.0", "@babel/types@^7.23.5": version "7.23.5" resolved "https://registry.npmjs.org/@babel/types/-/types-7.23.5.tgz#48d730a00c95109fa4393352705954d74fb5b602" @@ -1824,6 +1901,15 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping" "^0.3.9" +"@jridgewell/gen-mapping@^0.3.5": + version "0.3.5" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz#dcce6aff74bdf6dad1a95802b69b04a2fcb1fb36" + integrity sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg== + dependencies: + "@jridgewell/set-array" "^1.2.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.24" + "@jridgewell/resolve-uri@^3.0.3", "@jridgewell/resolve-uri@^3.1.0": version "3.1.1" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" @@ -1834,6 +1920,11 @@ resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== +"@jridgewell/set-array@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" + integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== + "@jridgewell/source-map@^0.3.3": version "0.3.5" resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.5.tgz#a3bb4d5c6825aab0d281268f47f6ad5853431e91" @@ -1842,7 +1933,7 @@ "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" -"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.13", "@jridgewell/sourcemap-codec@^1.4.14": version "1.4.15" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== @@ -1871,6 +1962,14 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" +"@jridgewell/trace-mapping@^0.3.24": + version "0.3.25" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" + integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + "@mapbox/node-pre-gyp@^1.0.0": version "1.0.11" resolved "https://registry.yarnpkg.com/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz#417db42b7f5323d79e93b34a6d7a2a12c0df43fa" @@ -2377,6 +2476,11 @@ "@sentry/types" "7.105.0" "@sentry/utils" "7.105.0" +"@sentry/babel-plugin-component-annotate@2.14.2": + version "2.14.2" + resolved "https://registry.yarnpkg.com/@sentry/babel-plugin-component-annotate/-/babel-plugin-component-annotate-2.14.2.tgz#d756bed93495e97a5a2aad56e2a6dc5020305adc" + integrity sha512-mFBVnIZmdMrpxo61rG5yf0WFt5VrRpy8cpIpJtT3mYkX9vDmcUZaZaD1ctv73iZF3QwaieVdn05Na5mWzZ8h/A== + "@sentry/browser@7.105.0": version "7.105.0" resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.105.0.tgz#3eb56785cfc1cf58528b29ea954b73093e6f9481" @@ -2390,6 +2494,74 @@ "@sentry/types" "7.105.0" "@sentry/utils" "7.105.0" +"@sentry/bundler-plugin-core@2.14.2": + version "2.14.2" + resolved "https://registry.yarnpkg.com/@sentry/bundler-plugin-core/-/bundler-plugin-core-2.14.2.tgz#6750c46fa4836b46ea48556b19f5e6789a428a47" + integrity sha512-HgOFWYdq87lSmeVW1w8K2Vf2DGzRPvKzHTajZYLTPlrZ1jbajq9vwuqhrJ9AnDkjl0mjyzSPEy3ZTeG1Z7uRNA== + dependencies: + "@babel/core" "7.18.5" + "@sentry/babel-plugin-component-annotate" "2.14.2" + "@sentry/cli" "^2.22.3" + dotenv "^16.3.1" + find-up "5.0.0" + glob "9.3.2" + magic-string "0.27.0" + unplugin "1.0.1" + +"@sentry/cli-darwin@2.29.1": + version "2.29.1" + resolved "https://registry.yarnpkg.com/@sentry/cli-darwin/-/cli-darwin-2.29.1.tgz#09f84f2af156bac446733117b48f5d743d90467f" + integrity sha512-FfYkME4stq6q1sWWsxFAjTa1pxc+GV+HTHYcnajqU+X0rQReoOvFvi00AHua1qKy8+lH5/RgEvMJcDBdoa0h3A== + +"@sentry/cli-linux-arm64@2.29.1": + version "2.29.1" + resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.29.1.tgz#5ecc844aa50178f7a6ab31eb28deea0fea7f5119" + integrity sha512-xcwNMJDC10kbi7T1kXRtZCMfgBtD3qLRgYEHJR0UuTONF+pF80uacdde+7oABW+rA3jy2G+4+cR5pN9M2x8wGQ== + +"@sentry/cli-linux-arm@2.29.1": + version "2.29.1" + resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm/-/cli-linux-arm-2.29.1.tgz#54d418fff574faf6bd23b57d5a6df62f637e36d6" + integrity sha512-lqOsmAVVgRYZzNyGQA1jnmALx0LnZ/Z7zc8/2TFrQYT7FUps5FP3yDDKlsUTaB8Z8A0++k7AqFgwlIeJw7+mPQ== + +"@sentry/cli-linux-i686@2.29.1": + version "2.29.1" + resolved "https://registry.yarnpkg.com/@sentry/cli-linux-i686/-/cli-linux-i686-2.29.1.tgz#d4131f36effc51b12b2f1bbef6c03b8361fac877" + integrity sha512-yOe7YEx42vl0Q8MgkbQmLbRe2KjijjMP+l9DYAfbOJHdTJ+3tNfBcRqFXsVNiobGxUeaVE5oDkOJ+7iGGgM2HA== + +"@sentry/cli-linux-x64@2.29.1": + version "2.29.1" + resolved "https://registry.yarnpkg.com/@sentry/cli-linux-x64/-/cli-linux-x64-2.29.1.tgz#922277cacba03fc7d8634b0efc3257c99a622e11" + integrity sha512-fzKh/lRwzZSb+QIebuWN9qXXABGarsL9V2xONGwWv202AueK0WFxr6/ADsE7OlmM/4cDby5Sd+oMKos2eeVcVA== + +"@sentry/cli-win32-i686@2.29.1": + version "2.29.1" + resolved "https://registry.yarnpkg.com/@sentry/cli-win32-i686/-/cli-win32-i686-2.29.1.tgz#93bc1b88832b498537da94a7cf8f3a688ce635b2" + integrity sha512-qdzg2nCSLfMgwhH7HLb6nPngJgbDvcOfDPtF+Y7axoe18iiQW0Ju7M9/e30t8vaOcUz9ZowQgFvxdgYlHJ3jMw== + +"@sentry/cli-win32-x64@2.29.1": + version "2.29.1" + resolved "https://registry.yarnpkg.com/@sentry/cli-win32-x64/-/cli-win32-x64-2.29.1.tgz#1bc0a746f3a94f7ed21108095e9cb5c9f585b7ad" + integrity sha512-CtGuRmwJ06WVMyVOq/Oa0l/1fI7rSAxcAlCzVAvj1p09aLXAGObGXmljXUeQ1jxE/Ll4yRAo9TjA8Y+vxPtkJw== + +"@sentry/cli@^2.22.3": + version "2.29.1" + resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-2.29.1.tgz#1089aabbdd2b5c34263f1de7e89bbed5b7dc06ef" + integrity sha512-STtuGm8vdR4ifR3I6mFmt9y7Dk9QzeOvpyXEG5H7dkFDSvU7cepkYAlli5QiZDzECngxGx/uLAzZzFKSATF1Qw== + 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" + optionalDependencies: + "@sentry/cli-darwin" "2.29.1" + "@sentry/cli-linux-arm" "2.29.1" + "@sentry/cli-linux-arm64" "2.29.1" + "@sentry/cli-linux-i686" "2.29.1" + "@sentry/cli-linux-x64" "2.29.1" + "@sentry/cli-win32-i686" "2.29.1" + "@sentry/cli-win32-x64" "2.29.1" + "@sentry/core@7.105.0", "@sentry/core@^7.100.0": version "7.105.0" resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.105.0.tgz#89db519dd9aa7326de63a7eaccf861de3769ab1c" @@ -2450,6 +2622,15 @@ "@sentry/types" "7.105.0" "@sentry/utils" "7.105.0" +"@sentry/webpack-plugin@^2.14.2": + version "2.14.2" + resolved "https://registry.yarnpkg.com/@sentry/webpack-plugin/-/webpack-plugin-2.14.2.tgz#4b3af44e98b967ea0730681f80b08c9f3660ad58" + integrity sha512-BEWF5qerGG/xX0ixEOCYh9gCkc+FHDzXxRMCFkM8yQNGH361ELF578KtuoZxXDy0kWa9QGZxSoP6/HZSnJEF9A== + dependencies: + "@sentry/bundler-plugin-core" "2.14.2" + unplugin "1.0.1" + uuid "^9.0.0" + "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" @@ -3491,7 +3672,7 @@ acorn@^8.0.4, acorn@^8.1.0, acorn@^8.8.2: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== -acorn@^8.11.3, acorn@^8.4.1, acorn@^8.5.0: +acorn@^8.11.3, acorn@^8.4.1, acorn@^8.5.0, acorn@^8.8.1: version "8.11.3" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== @@ -5006,6 +5187,11 @@ content-type@~1.0.4: resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== +convert-source-map@^1.7.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" + integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== + convert-source-map@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" @@ -6913,6 +7099,14 @@ find-cache-dir@^3.0.0, find-cache-dir@^3.3.1: make-dir "^3.0.2" pkg-dir "^4.1.0" +find-up@5.0.0, find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + find-up@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" @@ -6936,14 +7130,6 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" -find-up@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" - integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== - dependencies: - locate-path "^6.0.0" - path-exists "^4.0.0" - flat-cache@^3.0.4: version "3.2.0" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.2.0.tgz#2c0c2d5040c99b1632771a9d105725c0115363ee" @@ -7387,6 +7573,16 @@ glob-to-regexp@^0.4.1: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== +glob@9.3.2: + version "9.3.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-9.3.2.tgz#8528522e003819e63d11c979b30896e0eaf52eda" + integrity sha512-BTv/JhKXFEHsErMte/AnfiSv8yYOLLiyH2lTg8vn02O21zWFgHPTfxtgn1QRe7NRgggUhC8hacR2Re94svHqeA== + dependencies: + fs.realpath "^1.0.0" + minimatch "^7.4.1" + minipass "^4.2.4" + path-scurry "^1.6.1" + glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.1.7, glob@^7.2.0: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" @@ -9060,7 +9256,7 @@ json5@^1.0.1, json5@^1.0.2: dependencies: minimist "^1.2.0" -json5@^2.1.2, json5@^2.2.3: +json5@^2.1.2, json5@^2.2.1, json5@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== @@ -9496,11 +9692,23 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" +"lru-cache@^9.1.1 || ^10.0.0": + version "10.2.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.2.0.tgz#0bd445ca57363465900f4d1f9bd8db343a4d95c3" + integrity sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q== + luxon@^1.28.1: version "1.28.1" resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.28.1.tgz#528cdf3624a54506d710290a2341aa8e6e6c61b0" integrity sha512-gYHAa180mKrNIUJCbwpmD0aTu9kV0dREDrwNnuyFAsO1Wt0EVYSZelPnJlbj9HplzXX/YWXHFTL45kvZ53M0pw== +magic-string@0.27.0: + version "0.27.0" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.27.0.tgz#e4a3413b4bab6d98d2becffd48b4a257effdbbf3" + integrity sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA== + dependencies: + "@jridgewell/sourcemap-codec" "^1.4.13" + make-dir@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" @@ -9862,6 +10070,13 @@ minimatch@^5.0.1: dependencies: brace-expansion "^2.0.1" +minimatch@^7.4.1: + version "7.4.6" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-7.4.6.tgz#845d6f254d8f4a5e4fd6baf44d5f10c8448365fb" + integrity sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw== + dependencies: + brace-expansion "^2.0.1" + minimatch@~3.0.4: version "3.0.8" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.8.tgz#5e6a59bd11e2ab0de1cfb843eb2d82e546c321c1" @@ -9920,11 +10135,21 @@ minipass@^3.0.0, minipass@^3.1.0, minipass@^3.1.1, minipass@^3.1.3: dependencies: yallist "^4.0.0" +minipass@^4.2.4: + version "4.2.8" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-4.2.8.tgz#f0010f64393ecfc1d1ccb5f582bcaf45f48e1a3a" + integrity sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ== + minipass@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/minipass/-/minipass-5.0.0.tgz#3e9788ffb90b694a5d0ec94479a45b5d8738133d" integrity sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ== +"minipass@^5.0.0 || ^6.0.2 || ^7.0.0": + version "7.0.4" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.4.tgz#dbce03740f50a4786ba994c1fb908844d27b038c" + integrity sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ== + minizlib@^2.0.0, minizlib@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931" @@ -10848,6 +11073,14 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-scurry@^1.6.1: + version "1.10.1" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.10.1.tgz#9ba6bf5aa8500fe9fd67df4f0d9483b2b0bfc698" + integrity sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ== + dependencies: + lru-cache "^9.1.1 || ^10.0.0" + minipass "^5.0.0 || ^6.0.2 || ^7.0.0" + path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" @@ -11829,7 +12062,7 @@ process@^0.11.10: resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== -progress@^2.0.1: +progress@^2.0.1, progress@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== @@ -11882,7 +12115,7 @@ proxy-addr@~2.0.7: forwarded "0.2.0" ipaddr.js "1.9.1" -proxy-from-env@^1.0.0: +proxy-from-env@^1.0.0, proxy-from-env@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== @@ -14113,6 +14346,16 @@ unpipe@1.0.0, unpipe@~1.0.0: resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== +unplugin@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/unplugin/-/unplugin-1.0.1.tgz#83b528b981cdcea1cad422a12cd02e695195ef3f" + integrity sha512-aqrHaVBWW1JVKBHmGo33T5TxeL0qWzfvjWokObHA9bYmN7eNDkwOxmLjhioHl9878qDFMAaT51XNroRyuz7WxA== + dependencies: + acorn "^8.8.1" + chokidar "^3.5.3" + webpack-sources "^3.2.3" + webpack-virtual-modules "^0.5.0" + unset-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" @@ -14292,6 +14535,11 @@ uuid@^8.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== +uuid@^9.0.0: + version "9.0.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" + integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== + v8-compile-cache-lib@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" @@ -14602,6 +14850,16 @@ webpack-sources@^1.0.1, webpack-sources@^1.1.0, webpack-sources@^1.4.0, webpack- source-list-map "^2.0.0" source-map "~0.6.1" +webpack-sources@^3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" + integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== + +webpack-virtual-modules@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/webpack-virtual-modules/-/webpack-virtual-modules-0.5.0.tgz#362f14738a56dae107937ab98ea7062e8bdd3b6c" + integrity sha512-kyDivFZ7ZM0BVOUteVbDFhlRt7Ah/CSPwJdi8hBpkK7QLumUqdLtVfm/PX/hkcnrvr0i77fO5+TjZ94Pe+C9iw== + webpack@^4.47.0: version "4.47.0" resolved "https://registry.npmjs.org/webpack/-/webpack-4.47.0.tgz#8b8a02152d7076aeb03b61b47dad2eeed9810ebc" From f8156d5204b171f508ebfa204eca23b622074a04 Mon Sep 17 00:00:00 2001 From: Valentyne Stigloher Date: Sun, 25 Feb 2024 13:10:36 +0100 Subject: [PATCH 5/9] (sentry) activate sentry in server scripts --- nuxt.config.ts | 2 +- server/analyseLinks.js | 2 +- server/calendar.js | 2 +- server/calendarBot.js | 2 +- server/cards.js | 2 +- server/cleanupAccounts.js | 2 +- server/cleanupImages.js | 2 +- server/index.ts | 2 +- server/miastamaszerujace.js | 2 +- server/notify.js | 2 +- server/setup.ts | 8 ++++++++ server/stats.ts | 2 +- server/subscriptions.js | 2 +- server/termsImages.js | 2 +- server/tmp.js | 2 +- src/{dotenv.js => dotenv.ts} | 0 16 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 server/setup.ts rename src/{dotenv.js => dotenv.ts} (100%) diff --git a/nuxt.config.ts b/nuxt.config.ts index 2b4299366..90783863d 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,4 +1,4 @@ -import './src/dotenv.js'; +import './src/dotenv.ts'; import { loadSuml } from './server/loader.ts'; import autoprefixer from 'autoprefixer'; diff --git a/server/analyseLinks.js b/server/analyseLinks.js index 75c9cc2a6..8652d6985 100644 --- a/server/analyseLinks.js +++ b/server/analyseLinks.js @@ -1,4 +1,4 @@ -import '../src/dotenv.js'; +import './setup.ts'; import dbConnection from './db.ts'; import SQL from 'sql-template-strings'; diff --git a/server/calendar.js b/server/calendar.js index de2039400..ba521f5d4 100644 --- a/server/calendar.js +++ b/server/calendar.js @@ -1,4 +1,4 @@ -import '../src/dotenv.js'; +import './setup.ts'; import Pageres from 'pageres'; import fs from 'fs'; diff --git a/server/calendarBot.js b/server/calendarBot.js index 76fc3b242..f13c2229a 100644 --- a/server/calendarBot.js +++ b/server/calendarBot.js @@ -1,4 +1,4 @@ -import '../src/dotenv.js'; +import './setup.ts'; import Twitter from 'twitter'; import Mastodon from 'mastodon'; diff --git a/server/cards.js b/server/cards.js index d1fb10966..af4cb64f3 100644 --- a/server/cards.js +++ b/server/cards.js @@ -1,4 +1,4 @@ -import '../src/dotenv.js'; +import './setup.ts'; import Pageres from 'pageres'; import isHighLoadTime from './overload.js'; diff --git a/server/cleanupAccounts.js b/server/cleanupAccounts.js index c62c5ea64..e50c3b661 100644 --- a/server/cleanupAccounts.js +++ b/server/cleanupAccounts.js @@ -1,4 +1,4 @@ -import '../src/dotenv.js'; +import './setup.ts'; import dbConnection from './db.ts'; import mailer from '../src/mailer.ts'; diff --git a/server/cleanupImages.js b/server/cleanupImages.js index 51bb69726..b0e8983d9 100644 --- a/server/cleanupImages.js +++ b/server/cleanupImages.js @@ -1,4 +1,4 @@ -import '../src/dotenv.js'; +import './setup.ts'; import dbConnection from './db.ts'; import awsConfig from './aws.js'; diff --git a/server/index.ts b/server/index.ts index 03044e0e3..f0f8ed7c7 100644 --- a/server/index.ts +++ b/server/index.ts @@ -1,4 +1,4 @@ -import '../src/dotenv.js'; +import './setup.ts'; import express from 'express'; import type { Request, Response, NextFunction } from 'express'; diff --git a/server/miastamaszerujace.js b/server/miastamaszerujace.js index 55d6ffec4..7013cda1a 100644 --- a/server/miastamaszerujace.js +++ b/server/miastamaszerujace.js @@ -1,4 +1,4 @@ -import '../src/dotenv.js'; +import './setup.ts'; import fetch from 'node-fetch'; import { JSDOM } from 'jsdom'; diff --git a/server/notify.js b/server/notify.js index b9659bee9..7b6f6d210 100644 --- a/server/notify.js +++ b/server/notify.js @@ -1,4 +1,4 @@ -import '../src/dotenv.js'; +import './setup.ts'; import dbConnection from './db.ts'; import mailer from '../src/mailer.ts'; diff --git a/server/setup.ts b/server/setup.ts new file mode 100644 index 000000000..1a03691d6 --- /dev/null +++ b/server/setup.ts @@ -0,0 +1,8 @@ +import * as Sentry from '@sentry/node'; + +import '../src/dotenv.ts'; + +Sentry.init({ + dsn: process.env.SENTRY_DSN, + tracesSampleRate: 1.0, +}); diff --git a/server/stats.ts b/server/stats.ts index f433c2e2b..d47ffcbeb 100644 --- a/server/stats.ts +++ b/server/stats.ts @@ -1,4 +1,4 @@ -import '../src/dotenv.js'; +import './setup.ts'; import dbConnection from './db.ts'; import { calculateStats } from '../src/stats.ts'; diff --git a/server/subscriptions.js b/server/subscriptions.js index 13cee03da..9b2075301 100644 --- a/server/subscriptions.js +++ b/server/subscriptions.js @@ -1,4 +1,4 @@ -import '../src/dotenv.js'; +import './setup.ts'; import dbConnection from './db.ts'; import SQL from 'sql-template-strings'; diff --git a/server/termsImages.js b/server/termsImages.js index 36ba1ed07..60145694b 100644 --- a/server/termsImages.js +++ b/server/termsImages.js @@ -1,4 +1,4 @@ -import '../src/dotenv.js'; +import './setup.ts'; import dbConnection from './db.ts'; diff --git a/server/tmp.js b/server/tmp.js index 57337cf98..6bd11e626 100644 --- a/server/tmp.js +++ b/server/tmp.js @@ -1,4 +1,4 @@ -import '../src/dotenv.js'; +import './setup.ts'; import { decodeTime } from 'ulid'; import dbConnection from './db.ts'; import SQL from 'sql-template-strings'; diff --git a/src/dotenv.js b/src/dotenv.ts similarity index 100% rename from src/dotenv.js rename to src/dotenv.ts From b0a11cf07c4f20d1ad992ce25a282c2c55b5adb0 Mon Sep 17 00:00:00 2001 From: Valentyne Stigloher Date: Sun, 3 Mar 2024 13:32:23 +0100 Subject: [PATCH 6/9] (sentry) monitor database query performance --- server/index.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/server/index.ts b/server/index.ts index f0f8ed7c7..17aa63d7b 100644 --- a/server/index.ts +++ b/server/index.ts @@ -3,6 +3,7 @@ import './setup.ts'; import express from 'express'; import type { Request, Response, NextFunction } from 'express'; import * as Sentry from '@sentry/node'; +import type { StartSpanOptions } from '@sentry/types'; import authenticate from '../src/authenticate.ts'; import dbConnection from './db.ts'; import type { Database, SQLQuery } from './db.ts'; @@ -87,21 +88,33 @@ export class LazyDatabase implements Database { } } + buildSpanOptions(sql: SQLQuery): StartSpanOptions { + return { + name: typeof sql === 'string' ? sql : sql.sql, + op: 'db', + attributes: { + 'db.system': 'sqlite', + }, + }; + } + async get(sql: SQLQuery, ...args: unknown[]): Promise { await this.init(); - return this.db!.get(sql, ...args); + return Sentry.startSpan(this.buildSpanOptions(sql), () => this.db!.get(sql, ...args)); } async all(sql: SQLQuery, ...args: unknown[]): Promise { await this.init(); - return this.db!.all(sql, ...args); + return Sentry.startSpan(this.buildSpanOptions(sql), () => this.db!.all(sql, ...args)); } async close(): Promise { if (this.db !== null) { try { await this.db.close(); - } catch {} + } catch (error) { + Sentry.captureException(error); + } } } } From 29271951308285e0b49884b30a3e076d3243fb79 Mon Sep 17 00:00:00 2001 From: Valentyne Stigloher Date: Sun, 3 Mar 2024 14:24:08 +0100 Subject: [PATCH 7/9] (sentry) disable sending of user information --- nuxt.config.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/nuxt.config.ts b/nuxt.config.ts index 90783863d..3df35bc34 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -225,13 +225,26 @@ const nuxtConfig: NuxtConfig = { publishRelease: { telemetry: false, }, + config: { + beforeSend(event) { + // do not send user information as Sentry somehow automatically detects username, email and user id + // https://docs.sentry.io/platforms/javascript/data-management/sensitive-data/ + delete event.user; + return event; + }, + beforeSendTransaction(event) { + // see comment on nuxtConfig.sentry.config.beforeSend + delete event.user; + return event; + }, + }, }, publicRuntimeConfig: { ...config, plausible: { domain: process.env.PLAUSIBLE_DOMAIN || translations.domain, apiHost: process.env.PLAUSIBLE_API_HOST, - enableAutoPageviews: false, // see previous comment + enableAutoPageviews: false, // see comment on nuxtConfig.plausible.enableAutoPageviews }, }, watchers: { From 035756c274445d498f63e8eb24e0336895795aac Mon Sep 17 00:00:00 2001 From: Valentyne Stigloher Date: Sun, 3 Mar 2024 14:35:51 +0100 Subject: [PATCH 8/9] (privacy) add paragraph for Sentry --- locale/_base/translations.suml | 4 ++++ locale/en/translations.suml | 4 ++++ routes/privacy.vue | 5 +++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/locale/_base/translations.suml b/locale/_base/translations.suml index 4c06e039a..61806b942 100644 --- a/locale/_base/translations.suml +++ b/locale/_base/translations.suml @@ -1062,6 +1062,10 @@ privacy: We use Cloudflare Turnstile to filter out bots and prevent attacks. You can read their privacy policy {https://www.cloudflare.com/privacypolicy=here}. + sentry: > + We use Sentry to monitor for errors and performance issues. + The transmitted data has no relation to your username, unless it is contained inside the visited URL, + and your IP is not stored. logsBackups: > Logs and backups are stored for no longer than 18 months. gdpr: > diff --git a/locale/en/translations.suml b/locale/en/translations.suml index ac365501f..417f57896 100644 --- a/locale/en/translations.suml +++ b/locale/en/translations.suml @@ -1232,6 +1232,10 @@ privacy: We use Cloudflare Turnstile to filter out bots and prevent attacks. You can read their privacy policy {https://www.cloudflare.com/privacypolicy=here}. + sentry: > + We use Sentry to monitor for errors and performance issues. + The transmitted data has no relation to your username, unless it is contained inside the visited URL, + and your IP is not stored. ezoic: > In order to fund the project we show ads using a third party technology called Ezoic. You can opt-in to allow them to personalise your experience. diff --git a/routes/privacy.vue b/routes/privacy.vue index 6a69f242d..a854cb3eb 100644 --- a/routes/privacy.vue +++ b/routes/privacy.vue @@ -8,8 +8,8 @@

terms.lastUpdatequotation.colon - 2023-09-19 - (Publift) + 2024-03-03 + (Sentry)

@@ -29,6 +29,7 @@

privacy.content.cookies

privacy.content.plausible

privacy.content.turnstile

+

privacy.content.sentry

privacy.content.publift From f69aec7998da952d0283139a63af29ce69cb107e Mon Sep 17 00:00:00 2001 From: Valentyne Stigloher Date: Tue, 5 Mar 2024 18:18:04 +0100 Subject: [PATCH 9/9] (sentry) replace some console.error with Sentry.captureException --- components/AccountSwitch.vue | 5 +++-- components/ForeignPronoun.vue | 6 ++++-- layouts/default.vue | 7 ++++--- nuxt.config.ts | 5 ++++- plugins/track.js | 6 ++++-- server/audit.ts | 5 +++-- server/calendarBot.js | 11 ++++++----- server/cards.js | 5 +++-- server/cleanupAccounts.js | 6 ++++-- server/miastamaszerujace.js | 3 ++- server/routes/calendar.js | 3 ++- server/routes/profile.js | 3 ++- server/setup.ts | 4 ++++ src/helpers.ts | 5 +++-- src/jwt.ts | 5 +++-- src/mailer.ts | 3 ++- src/translator.js | 4 +++- 17 files changed, 56 insertions(+), 30 deletions(-) diff --git a/components/AccountSwitch.vue b/components/AccountSwitch.vue index 8e21a703f..b278257ff 100644 --- a/components/AccountSwitch.vue +++ b/components/AccountSwitch.vue @@ -33,6 +33,7 @@