From 720277b6ef37d76cef6fb80e2d95452820d8f49d Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Tue, 5 Dec 2023 15:49:31 -0500 Subject: [PATCH 01/13] chore: add sentry to package.json --- package-lock.json | 295 ++++++++++++++++++++++++++++++++++++++++++++-- package.json | 9 +- 2 files changed, 289 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index 815b427e9..035992462 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,8 @@ "@mui/material": "^5.14.14", "@mui/x-data-grid": "^6.17.0", "@reduxjs/toolkit": "^1.9.7", + "@sentry/cli": "^2.22.3", + "@sentry/react": "^7.85.0", "@turf/bbox": "^6.5.0", "@turf/center": "^6.5.0", "@turf/helpers": "^6.5.0", @@ -6547,6 +6549,268 @@ "integrity": "sha512-6i/8UoL0P5y4leBIGzvkZdS85RDMG9y1ihZzmTZQ5LdHUYmZ7pKFoj8X0236s3lusPs1Fa5HTQUpwI+UfTcmeA==", "dev": true }, + "node_modules/@sentry-internal/feedback": { + "version": "7.85.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-7.85.0.tgz", + "integrity": "sha512-MlbIN+N8CWFJBjbqMmARe4+UPo9QRhRar0YoOfmNA2Xqk/EwXcjHWkealosHznXH7tqVbjB25QJpHtDystft/Q==", + "dependencies": { + "@sentry/core": "7.85.0", + "@sentry/types": "7.85.0", + "@sentry/utils": "7.85.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@sentry-internal/tracing": { + "version": "7.85.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.85.0.tgz", + "integrity": "sha512-p3YMUwkPCy2su9cm/3+7QYR4RiMI0+07DU1BZtht9NLTzY2O87/yvUbn1v2yHR3vJQTy/+7N0ud9/mPBFznRQQ==", + "dependencies": { + "@sentry/core": "7.85.0", + "@sentry/types": "7.85.0", + "@sentry/utils": "7.85.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/browser": { + "version": "7.85.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.85.0.tgz", + "integrity": "sha512-x4sH7vTQnZQgy1U7NuN8XwhleAw7YMQitccHeC5m+kpIKGUO7w4Mdvu8rD3dnjmVmZvASpnwocAxy57/vCU6Ww==", + "dependencies": { + "@sentry-internal/feedback": "7.85.0", + "@sentry-internal/tracing": "7.85.0", + "@sentry/core": "7.85.0", + "@sentry/replay": "7.85.0", + "@sentry/types": "7.85.0", + "@sentry/utils": "7.85.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/cli": { + "version": "2.22.3", + "resolved": "https://registry.npmjs.org/@sentry/cli/-/cli-2.22.3.tgz", + "integrity": "sha512-VFHdtrHsMyTRSZhDLeMyXvit7xB4e81KugIEwMve95c7h5HO672bfmCcM/403CAugj4NzvQ+IR2NKF/2SsEPlg==", + "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.22.3", + "@sentry/cli-linux-arm": "2.22.3", + "@sentry/cli-linux-arm64": "2.22.3", + "@sentry/cli-linux-i686": "2.22.3", + "@sentry/cli-linux-x64": "2.22.3", + "@sentry/cli-win32-i686": "2.22.3", + "@sentry/cli-win32-x64": "2.22.3" + } + }, + "node_modules/@sentry/cli-darwin": { + "version": "2.22.3", + "resolved": "https://registry.npmjs.org/@sentry/cli-darwin/-/cli-darwin-2.22.3.tgz", + "integrity": "sha512-A1DwFTffg3+fF68qujaJI07dk/1H1pRuihlvS5WQ9sD7nQLnXZGoLUht4eULixhDzZYinWHKkcWzQ6k40UTvNA==", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-arm": { + "version": "2.22.3", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm/-/cli-linux-arm-2.22.3.tgz", + "integrity": "sha512-mDtLVbqbCu/5b/v2quTAMzY/atGlJVvrqO2Wvpro0Jb/LYhn7Y1pVBdoXEDcnOX82/pseFkLT8PFfq/OcezPhA==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux", + "freebsd" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-arm64": { + "version": "2.22.3", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.22.3.tgz", + "integrity": "sha512-PnBPb4LJ+A2LlqLjtVFn4mEizcVdxBSLZvB85pEGzq9DRXjZ6ZEuGWFHTVnWvjd79TB/s0me29QnLc3n4B6lgA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux", + "freebsd" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-i686": { + "version": "2.22.3", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-i686/-/cli-linux-i686-2.22.3.tgz", + "integrity": "sha512-wxvbpQ2hiw4hwJWfJMp7K45BV40nXL62f91jLuftFXIbieKX1Li57NNKNu2JUVn7W1bJxkwz/PKGGTXSgeJlRw==", + "cpu": [ + "x86", + "ia32" + ], + "optional": true, + "os": [ + "linux", + "freebsd" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-x64": { + "version": "2.22.3", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-x64/-/cli-linux-x64-2.22.3.tgz", + "integrity": "sha512-0GxsYNO5GyRWifeOpng+MmdUFZRA64bgA1n1prsEsXnoeLcm3Zj4Q63hBZmiwz9Qbhf5ibohkpf94a7dI7pv3A==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux", + "freebsd" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-win32-i686": { + "version": "2.22.3", + "resolved": "https://registry.npmjs.org/@sentry/cli-win32-i686/-/cli-win32-i686-2.22.3.tgz", + "integrity": "sha512-YERPsd7ClBrxKcmCUw+ZrAvQfbyIZFrqh269hgDuXFodpsB7LPGnI33ilo0uzmKdq2vGppTb6Z3gf1Rbq0Hadg==", + "cpu": [ + "x86", + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-win32-x64": { + "version": "2.22.3", + "resolved": "https://registry.npmjs.org/@sentry/cli-win32-x64/-/cli-win32-x64-2.22.3.tgz", + "integrity": "sha512-NUh56xWvgJo2KuC9lI6o6nTPXdzbpQUB4qGwJ73L9NP3HT2P1I27jtHyrC2zlXTVlYE23gQZGrL3wgW4Jy80QA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/@sentry/cli/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@sentry/core": { + "version": "7.85.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.85.0.tgz", + "integrity": "sha512-DFDAc4tWmHN5IWhr7XbHCiyF1Xgb95jz8Uj/JTX9atlgodId1UIbER77qpEmH3eQGid/QBdqrlR98zCixgSbwg==", + "dependencies": { + "@sentry/types": "7.85.0", + "@sentry/utils": "7.85.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/react": { + "version": "7.85.0", + "resolved": "https://registry.npmjs.org/@sentry/react/-/react-7.85.0.tgz", + "integrity": "sha512-digw63l1A9n+74rW8uiG575Xh3qWTkmvwgTfNRFvDokDRMqRTP0iQEqZRBrBEzMZ5JUa6s+5NLc1/dbMh1QQgA==", + "dependencies": { + "@sentry/browser": "7.85.0", + "@sentry/types": "7.85.0", + "@sentry/utils": "7.85.0", + "hoist-non-react-statics": "^3.3.2" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "react": "15.x || 16.x || 17.x || 18.x" + } + }, + "node_modules/@sentry/replay": { + "version": "7.85.0", + "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.85.0.tgz", + "integrity": "sha512-zVtTKfO+lu5qTwHpETI/oGo8hU3rdKHr3CdI1vRLw+d60PcAa/pWVlXsQeLRTw8PFwE358gHcpFZezj/11afew==", + "dependencies": { + "@sentry-internal/tracing": "7.85.0", + "@sentry/core": "7.85.0", + "@sentry/types": "7.85.0", + "@sentry/utils": "7.85.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@sentry/types": { + "version": "7.85.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.85.0.tgz", + "integrity": "sha512-R5jR4XkK5tBU2jDiPdSVqzkmjYRr666bcGaFGUHB/xDQCjPsjk+pEmCCL+vpuWoaZmQJUE1hVU7rgnVX81w8zg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/utils": { + "version": "7.85.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.85.0.tgz", + "integrity": "sha512-JZ7seNOLvhjAQ8GeB3GYknPQJkuhF88xAYOaESZP3xPOWBMFUN+IO4RqjMqMLFDniOwsVQS7GB/MfP+hxufieg==", + "dependencies": { + "@sentry/types": "7.85.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -12649,7 +12913,7 @@ "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", - "dev": true, + "devOptional": true, "dependencies": { "iconv-lite": "^0.6.2" } @@ -15943,7 +16207,7 @@ "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "dev": true, + "devOptional": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" }, @@ -16859,8 +17123,7 @@ "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, "node_modules/isomorphic-ws": { "version": "5.0.0", @@ -22259,7 +22522,6 @@ "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dev": true, "dependencies": { "whatwg-url": "^5.0.0" }, @@ -24688,6 +24950,14 @@ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, + "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": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", @@ -24757,6 +25027,11 @@ "node": ">= 0.10" } }, + "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/psl": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", @@ -27666,7 +27941,7 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true + "devOptional": true }, "node_modules/sanitize.css": { "version": "13.0.0", @@ -30268,8 +30543,7 @@ "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, "node_modules/traverse": { "version": "0.6.7", @@ -31394,7 +31668,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dev": true, "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -31403,14 +31676,12 @@ "node_modules/whatwg-url/node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dev": true + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, "dependencies": { "isexe": "^2.0.0" }, diff --git a/package.json b/package.json index c0bddd1ee..25631b9d2 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,8 @@ "@mui/material": "^5.14.14", "@mui/x-data-grid": "^6.17.0", "@reduxjs/toolkit": "^1.9.7", + "@sentry/cli": "^2.22.3", + "@sentry/react": "^7.85.0", "@turf/bbox": "^6.5.0", "@turf/center": "^6.5.0", "@turf/helpers": "^6.5.0", @@ -69,7 +71,7 @@ "lint-css": "stylelint --config=.stylelintrc '**/*.css'", "format-css": "npm run lint-css -- --fix", "check-modules": "depcheck", - "build": "npm run generate-types && react-scripts build", + "build": "npm run generate-types && react-scripts build && npm run sentry:sourcemaps", "build-serve": "serve -s build", "test": "npm run generate-types && react-scripts test", "test-debug": "npm run generate-types && react-scripts --inspect-brk test --runInBand --no-cache", @@ -78,7 +80,8 @@ "localization-to-po": "node scripts/localization/transform-to.mjs po", "localization-to-json": "node scripts/localization/transform-to.mjs json", "localization-check-missing": "node scripts/localization/missing-check.mjs", - "eject": "react-scripts eject" + "eject": "react-scripts eject", + "sentry:sourcemaps": "sentry-cli sourcemaps inject --org techmatters --project terraso-web-client ./build && sentry-cli sourcemaps upload --org techmatters --project terraso-web-client ./build" }, "browserslist": [ ">0.2%", @@ -151,4 +154,4 @@ } } } -} +} \ No newline at end of file From 497010fd4f700fdafdf2d9292993f3ae72ac91aa Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Tue, 5 Dec 2023 15:49:46 -0500 Subject: [PATCH 02/13] chore: git ignore .sentryclirc --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index d58213862..bfba0d1b7 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,6 @@ local.env # generated src/terrasoApi/shared/graphqlSchema + +# Sentry Config File +.sentryclirc From 465ee2a046edac39d7bd41eddcfce2d236b4f9ee Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Tue, 5 Dec 2023 15:50:05 -0500 Subject: [PATCH 03/13] fix: add sentry config init --- src/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/index.js b/src/index.js index 2a143ceec..bfa19e35e 100644 --- a/src/index.js +++ b/src/index.js @@ -15,6 +15,7 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import React from 'react'; +import * as Sentry from '@sentry/react'; import 'config'; @@ -31,6 +32,22 @@ import 'index.css'; import App from 'App'; +Sentry.init({ + dsn: 'https://dac0c436847fc922e68de0855b5ff738@o4506299756642304.ingest.sentry.io/4506345074130944', + integrations: [ + new Sentry.BrowserTracing({ + // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled + tracePropagationTargets: ['localhost', /^https:\/\/yourserver\.io\/api/], + }), + new Sentry.Replay(), + ], + // Performance Monitoring + tracesSampleRate: 1.0, // Capture 100% of the transactions + // Session Replay + replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production. + replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur. +}); + createRoot(document.getElementById('root')).render( From d2007975775e4cf12e4ac372a2a90a12a33e5f19 Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Tue, 5 Dec 2023 15:58:26 -0500 Subject: [PATCH 04/13] stye: restore newline to end of package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 25631b9d2..c82617927 100644 --- a/package.json +++ b/package.json @@ -154,4 +154,4 @@ } } } -} \ No newline at end of file +} From d09f99bdce89f9e5445b5b0b6e5092f7f015065f Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Tue, 5 Dec 2023 16:28:43 -0500 Subject: [PATCH 05/13] fix: add SENTRY_AUTH_TOKEN to GitHub CI environment --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 48ec33fa2..947bb162d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,6 +79,8 @@ jobs: build: runs-on: ubuntu-latest + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} steps: - name: Checkout From 87ce8eb3a8459dfd9d45993dc6f8790254fb218c Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Wed, 6 Dec 2023 12:43:54 -0500 Subject: [PATCH 06/13] chore: add sentry placeholders to local.env.sample --- local.env.sample | 2 ++ 1 file changed, 2 insertions(+) diff --git a/local.env.sample b/local.env.sample index 21f127a92..603f09958 100644 --- a/local.env.sample +++ b/local.env.sample @@ -4,3 +4,5 @@ REACT_APP_PLAUSIBLE_DOMAIN=app.local.terraso.org REACT_APP_SHARED_DATA_ACCEPTED_EXTENSIONS=csv,doc,docx,pdf,ppt,pptx,xlsx,xls REACT_APP_IMAGE_ACCEPTED_EXTENSIONS=jpeg,jpg REACT_APP_MAPBOX_ACCESS_TOKEN= +SENTRY_AUTH_TOKEN=sntrys_eyxxxxxxxxxxx +SENTRY_DSN=https://xyz@o4506299756642304.ingest.sentry.io/abcd From f9d42e431716ba3c3728cb8517b86eacccf8cb87 Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Wed, 6 Dec 2023 12:44:20 -0500 Subject: [PATCH 07/13] fix: get SENTRY_DSN from environment --- src/config.ts | 2 ++ src/index.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/config.ts b/src/config.ts index 28e2b8658..70b05bccf 100644 --- a/src/config.ts +++ b/src/config.ts @@ -38,6 +38,8 @@ const COOKIES_PARAMS = { path: '/', domain: COOKIES_DOMAIN }; export const ROLLBAR_TOKEN = process.env.REACT_APP_ROLLBAR_TOKEN; +export const SENTRY_DSN = process.env.SENTRY_DSN; + setAPIConfig({ terrasoAPIURL: TERRASO_API_URL, graphQLEndpoint: GRAPHQL_ENDPOINT, diff --git a/src/index.js b/src/index.js index bfa19e35e..c5c6d5316 100644 --- a/src/index.js +++ b/src/index.js @@ -33,7 +33,7 @@ import 'index.css'; import App from 'App'; Sentry.init({ - dsn: 'https://dac0c436847fc922e68de0855b5ff738@o4506299756642304.ingest.sentry.io/4506345074130944', + dsn: config.SENTRY_DSN, integrations: [ new Sentry.BrowserTracing({ // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled From a9c5a8333dfe4574259244d1ddb415c245a4f39a Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Wed, 6 Dec 2023 12:48:28 -0500 Subject: [PATCH 08/13] fix: correct SENTRY_DSN import --- src/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index c5c6d5316..258856269 100644 --- a/src/index.js +++ b/src/index.js @@ -16,9 +16,6 @@ */ import React from 'react'; import * as Sentry from '@sentry/react'; - -import 'config'; - import { createRoot } from 'react-dom/client'; import createStore from 'terrasoApi/store'; @@ -26,6 +23,8 @@ import AppWrappers from 'layout/AppWrappers'; import reportWebVitals from 'monitoring/reportWebVitals'; import rules from 'permissions/rules'; +import { SENTRY_DSN } from 'config'; + import theme from 'theme'; import 'index.css'; @@ -33,7 +32,7 @@ import 'index.css'; import App from 'App'; Sentry.init({ - dsn: config.SENTRY_DSN, + dsn: SENTRY_DSN, integrations: [ new Sentry.BrowserTracing({ // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled From a37a6520c8e2cb12b16ef67b699d666acf34a927 Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Wed, 6 Dec 2023 12:51:15 -0500 Subject: [PATCH 09/13] fix: add auth token to lint task --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 947bb162d..903c7ce3f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,8 @@ on: jobs: lint: runs-on: ubuntu-latest + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} steps: - name: Checkout From ccbf4cfd631e9fc39d0b1de1ee70e982286c3ad1 Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Thu, 7 Dec 2023 10:48:15 -0500 Subject: [PATCH 10/13] fix: change "local" to "development" environment --- src/config.ts | 2 +- src/monitoring/analytics.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.ts b/src/config.ts index 70b05bccf..85675e466 100644 --- a/src/config.ts +++ b/src/config.ts @@ -21,7 +21,7 @@ import type { Severity } from 'terraso-client-shared/monitoring/logger'; import { rollbar } from 'monitoring/rollbar'; -export const TERRASO_ENV = process.env.REACT_APP_TERRASO_ENV || 'local'; +export const TERRASO_ENV = process.env.REACT_APP_TERRASO_ENV || 'development'; export const TERRASO_API_URL = process.env.REACT_APP_TERRASO_API_URL || 'http://127.0.0.1:8000'; diff --git a/src/monitoring/analytics.js b/src/monitoring/analytics.js index 96a121e6e..f83ec801a 100644 --- a/src/monitoring/analytics.js +++ b/src/monitoring/analytics.js @@ -22,7 +22,7 @@ import { PLAUSIBLE_DOMAIN, TERRASO_ENV } from 'config'; export const plausible = Plausible({ domain: PLAUSIBLE_DOMAIN, - trackLocalhost: TERRASO_ENV === 'local', + trackLocalhost: TERRASO_ENV === 'development', }); plausible.enableAutoPageviews(); From 01db6a3351711eb25d77e70f754cdb694efcc80d Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Thu, 7 Dec 2023 10:48:31 -0500 Subject: [PATCH 11/13] fix: add environment to sentry --- src/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 258856269..2b170c132 100644 --- a/src/index.js +++ b/src/index.js @@ -23,7 +23,7 @@ import AppWrappers from 'layout/AppWrappers'; import reportWebVitals from 'monitoring/reportWebVitals'; import rules from 'permissions/rules'; -import { SENTRY_DSN } from 'config'; +import { SENTRY_DSN, TERRASO_ENV } from 'config'; import theme from 'theme'; @@ -33,6 +33,7 @@ import App from 'App'; Sentry.init({ dsn: SENTRY_DSN, + environment: TERRASO_ENV, integrations: [ new Sentry.BrowserTracing({ // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled From 9cee5dd916adffb560eddf417c69a751fc2b5263 Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Thu, 7 Dec 2023 10:52:37 -0500 Subject: [PATCH 12/13] fix: change environment from "local" to "development" --- local.env.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local.env.sample b/local.env.sample index 603f09958..e57917ba1 100644 --- a/local.env.sample +++ b/local.env.sample @@ -1,4 +1,4 @@ -REACT_APP_TERRASO_ENV=local +REACT_APP_TERRASO_ENV=development REACT_APP_TERRASO_API_URL=http://127.0.0.1:8000 REACT_APP_PLAUSIBLE_DOMAIN=app.local.terraso.org REACT_APP_SHARED_DATA_ACCEPTED_EXTENSIONS=csv,doc,docx,pdf,ppt,pptx,xlsx,xls From 419631e8c4b6f68b3c566b8ededfd1835674a56e Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Thu, 7 Dec 2023 10:58:19 -0500 Subject: [PATCH 13/13] fix: change REACT_APP_TERRASO_ENV to ENV --- local.env.sample | 2 +- src/config.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/local.env.sample b/local.env.sample index e57917ba1..02aa171d0 100644 --- a/local.env.sample +++ b/local.env.sample @@ -1,4 +1,4 @@ -REACT_APP_TERRASO_ENV=development +ENV=development REACT_APP_TERRASO_API_URL=http://127.0.0.1:8000 REACT_APP_PLAUSIBLE_DOMAIN=app.local.terraso.org REACT_APP_SHARED_DATA_ACCEPTED_EXTENSIONS=csv,doc,docx,pdf,ppt,pptx,xlsx,xls diff --git a/src/config.ts b/src/config.ts index 85675e466..091d10ca7 100644 --- a/src/config.ts +++ b/src/config.ts @@ -21,7 +21,7 @@ import type { Severity } from 'terraso-client-shared/monitoring/logger'; import { rollbar } from 'monitoring/rollbar'; -export const TERRASO_ENV = process.env.REACT_APP_TERRASO_ENV || 'development'; +export const TERRASO_ENV = process.env.ENV || 'development'; export const TERRASO_API_URL = process.env.REACT_APP_TERRASO_API_URL || 'http://127.0.0.1:8000';