From 2335fe7acffffff3557eb5a1708d38f8a4335203 Mon Sep 17 00:00:00 2001 From: Simon Hellmayr Date: Thu, 17 Apr 2025 13:23:15 +0200 Subject: [PATCH 1/4] feat(nuxt): add bad connection detection to example page --- src/nuxt/templates.ts | 116 ++++++++++-------------------------------- 1 file changed, 27 insertions(+), 89 deletions(-) diff --git a/src/nuxt/templates.ts b/src/nuxt/templates.ts index 6b62fdc53..ad00a244b 100644 --- a/src/nuxt/templates.ts +++ b/src/nuxt/templates.ts @@ -158,6 +158,16 @@ Feel free to delete this file. import { useFetch} from '#imports' const hasSentError = ref(false); + const isConnected = ref(true); + + onMounted(async () => { + try { + const result = await Sentry.diagnoseSdkConnectivity(); + isConnected.value = result !== 'sentry-unreachable'; + } catch (error) { + isConnected.value = false; + } + }); function getSentryData() { Sentry.startSpan( @@ -189,7 +199,7 @@ Feel free to delete this file.

- Click the button below, and view the sample error on the Sentry Issues Page. + Click the button below, and view the sample error on the Sentry Issues Page. For more details about setting up Sentry, read our docs.

@@ -205,6 +215,9 @@ Feel free to delete this file.

Sample error was sent to Sentry.

+
+

The Sentry SDK is not able to reach Sentry right now - this may be due to an adblocker. For more information, see the troubleshooting guide.

+
@@ -321,98 +334,23 @@ Feel free to delete this file. .success_placeholder { height: 46px; } - -`; -} - -export function getSentryExampleApiTemplate() { - return `// This is just a very simple API route that throws an example error. -// Feel free to delete this file. -import { defineEventHandler } from '#imports'; - -export default defineEventHandler(() => { - throw new Error("Sentry Example API Route Error"); -}); -`; -} - -export function getSentryErrorButtonTemplate() { - return ` - - - - - - + `; } From 2651ca1e06c68d58deb4914606bdd826ae76cc5b Mon Sep 17 00:00:00 2001 From: Simon Hellmayr Date: Thu, 17 Apr 2025 13:24:05 +0200 Subject: [PATCH 2/4] add changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25013f85a..834a1dd7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ - feat(nextjs): Add connectivity check to example page([#951](https://github.com/getsentry/sentry-wizard/pull/951)) - feat(nextjs): Improve error names in example page to better differentiate between frontend and API errors ([#944](https://github.com/getsentry/sentry-wizard/pull/944)) - fix(remix): linting issues in generated client init code ([#949](https://github.com/getsentry/sentry-wizard/pull/949)) +- feat(nuxt): Add connectivity check to example page ([#966](https://github.com/getsentry/sentry-wizard/pull/966)) + ## 4.7.0 From d39fa6c273ddc4f009d31f86440a20eded6d70d0 Mon Sep 17 00:00:00 2001 From: Simon Hellmayr Date: Thu, 17 Apr 2025 13:26:39 +0200 Subject: [PATCH 3/4] revert the oopsie --- src/nuxt/templates.ts | 92 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/src/nuxt/templates.ts b/src/nuxt/templates.ts index ad00a244b..e3a5d6b77 100644 --- a/src/nuxt/templates.ts +++ b/src/nuxt/templates.ts @@ -354,3 +354,95 @@ Feel free to delete this file. `; } + +export function getSentryExampleApiTemplate() { + return `// This is just a very simple API route that throws an example error. +// Feel free to delete this file. +import { defineEventHandler } from '#imports'; + +export default defineEventHandler(() => { + throw new Error("Sentry Example API Route Error"); +}); +`; +} + +export function getSentryErrorButtonTemplate() { + return ` + + + + + + +`; +} From 84ddbbd86bcf375bfdaaafcd2e09a248d2e1dfbc Mon Sep 17 00:00:00 2001 From: Simon Hellmayr Date: Thu, 17 Apr 2025 13:27:32 +0200 Subject: [PATCH 4/4] fix url --- src/nuxt/templates.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nuxt/templates.ts b/src/nuxt/templates.ts index e3a5d6b77..536257a9b 100644 --- a/src/nuxt/templates.ts +++ b/src/nuxt/templates.ts @@ -199,7 +199,7 @@ Feel free to delete this file.

- Click the button below, and view the sample error on the Sentry Issues Page. + Click the button below, and view the sample error on the Sentry Issues Page. For more details about setting up Sentry, read our docs.