From 8d332a31f6a05a72069f15656ab4cf0a4c3f3123 Mon Sep 17 00:00:00 2001 From: evilpeach Date: Tue, 14 Feb 2023 16:36:33 +0700 Subject: [PATCH 1/6] feat: setup sentry tunnel --- CHANGELOG.md | 1 + next.config.js | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8e88b4b2..90de9aacf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -115,6 +115,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Improvements +- [#190](https://github.com/alleslabs/celatone-frontend/pull/190) Setup sentry tunnel in next config - [#179](https://github.com/alleslabs/celatone-frontend/pull/179) Add loading state to My code, Recent Codes, Contract details, Code details, All public projects, Public project, Saved Contract, Instantiated my be - [#182](https://github.com/alleslabs/celatone-frontend/pull/182) Disable mainnet store code and show alert, refactor select chain hook and alert variants - [#180](https://github.com/alleslabs/celatone-frontend/pull/180) Add helper text to editable cell, Change trash button to bookmark button diff --git a/next.config.js b/next.config.js index 6996e4f8b..589f76e0d 100644 --- a/next.config.js +++ b/next.config.js @@ -7,6 +7,17 @@ const nextConfig = { eslint: { dirs: ["src"], }, + async rewrites() { + return [ + { + source: "/sentry/:path*", + // https://abcdefghijklmnopqrstquwxyzabcdef@o123456.ingest.sentry.io/1234567 + destination: `https://${ + process.env.SENTRY_DSN.split("@")[1].split("/")[0] + }/:path*`, + }, + ]; + }, }; const moduleExports = { @@ -14,6 +25,7 @@ const moduleExports = { sentry: { hideSourceMaps: true, + tunnelRoute: "/sentry", }, }; From a0fb6b229f90f4fcf0176635b0e27ca3dc38b854 Mon Sep 17 00:00:00 2001 From: evilpeach Date: Tue, 14 Feb 2023 16:41:01 +0700 Subject: [PATCH 2/6] fix: sentry dsn --- next.config.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/next.config.js b/next.config.js index 589f76e0d..fb3634fe4 100644 --- a/next.config.js +++ b/next.config.js @@ -1,5 +1,7 @@ const { withSentryConfig } = require("@sentry/nextjs"); +const SENTRY_DSN = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN; + /** @type {import('next').NextConfig} */ const nextConfig = { swcMinify: true, @@ -12,9 +14,7 @@ const nextConfig = { { source: "/sentry/:path*", // https://abcdefghijklmnopqrstquwxyzabcdef@o123456.ingest.sentry.io/1234567 - destination: `https://${ - process.env.SENTRY_DSN.split("@")[1].split("/")[0] - }/:path*`, + destination: `https://${SENTRY_DSN.split("@")[1].split("/")[0]}/:path*`, }, ]; }, From f905c85bdb52d61ce05d563ecd339df1a60b8c8e Mon Sep 17 00:00:00 2001 From: evilpeach Date: Tue, 14 Feb 2023 16:43:34 +0700 Subject: [PATCH 3/6] fix: change env --- next.config.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/next.config.js b/next.config.js index fb3634fe4..f444c5c32 100644 --- a/next.config.js +++ b/next.config.js @@ -1,7 +1,5 @@ const { withSentryConfig } = require("@sentry/nextjs"); -const SENTRY_DSN = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN; - /** @type {import('next').NextConfig} */ const nextConfig = { swcMinify: true, @@ -14,7 +12,9 @@ const nextConfig = { { source: "/sentry/:path*", // https://abcdefghijklmnopqrstquwxyzabcdef@o123456.ingest.sentry.io/1234567 - destination: `https://${SENTRY_DSN.split("@")[1].split("/")[0]}/:path*`, + destination: `https://${ + process.env.NEXT_PUBLIC_SENTRY_DSN.split("@")[1].split("/")[0] + }/:path*`, }, ]; }, From a595705e2e3f90417b3f0e666dbc48591a6cc321 Mon Sep 17 00:00:00 2001 From: evilpeach Date: Tue, 14 Feb 2023 17:31:19 +0700 Subject: [PATCH 4/6] chore: test throw error --- src/lib/pages/query/components/QueryArea.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/pages/query/components/QueryArea.tsx b/src/lib/pages/query/components/QueryArea.tsx index 0f85ea867..ddfef0518 100644 --- a/src/lib/pages/query/components/QueryArea.tsx +++ b/src/lib/pages/query/components/QueryArea.tsx @@ -136,6 +136,7 @@ export const QueryArea = ({ p="6px 16px" onClick={() => { refetch(); + throw new Error("test"); }} isDisabled={jsonValidate(msg) !== null} isLoading={isFetching || isRefetching} From 7d23bfcf41c12c417afa7d4df7e21f6d6d50222e Mon Sep 17 00:00:00 2001 From: evilpeach Date: Tue, 14 Feb 2023 17:34:18 +0700 Subject: [PATCH 5/6] feat: add fallback sentry dsn --- next.config.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/next.config.js b/next.config.js index f444c5c32..861d22dfe 100644 --- a/next.config.js +++ b/next.config.js @@ -1,6 +1,10 @@ const { withSentryConfig } = require("@sentry/nextjs"); /** @type {import('next').NextConfig} */ +const SENTRY_DSN = + process.env.NEXT_PUBLIC_SENTRY_DSN ?? + "https://examplePublicKey@o0.ingest.sentry.io/0"; + const nextConfig = { swcMinify: true, reactStrictMode: true, @@ -12,9 +16,7 @@ const nextConfig = { { source: "/sentry/:path*", // https://abcdefghijklmnopqrstquwxyzabcdef@o123456.ingest.sentry.io/1234567 - destination: `https://${ - process.env.NEXT_PUBLIC_SENTRY_DSN.split("@")[1].split("/")[0] - }/:path*`, + destination: `https://${SENTRY_DSN.split("@")[1].split("/")[0]}/:path*`, }, ]; }, From 3d85844d66146ddc87e13e9bf22d818cc6c2ba97 Mon Sep 17 00:00:00 2001 From: evilpeach Date: Tue, 14 Feb 2023 17:55:11 +0700 Subject: [PATCH 6/6] chore: remove throw error --- src/lib/pages/query/components/QueryArea.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/pages/query/components/QueryArea.tsx b/src/lib/pages/query/components/QueryArea.tsx index ddfef0518..0f85ea867 100644 --- a/src/lib/pages/query/components/QueryArea.tsx +++ b/src/lib/pages/query/components/QueryArea.tsx @@ -136,7 +136,6 @@ export const QueryArea = ({ p="6px 16px" onClick={() => { refetch(); - throw new Error("test"); }} isDisabled={jsonValidate(msg) !== null} isLoading={isFetching || isRefetching}