Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

propagate sentry issue id to form (#38714)

Jordi Enric3d55164563db
diff --git a/apps/studio/components/interfaces/Support/SupportFormV2.tsx b/apps/studio/components/interfaces/Support/SupportFormV2.tsx
index c0c1c7ef988..5d8077f91a8 100644
--- a/apps/studio/components/interfaces/Support/SupportFormV2.tsx
+++ b/apps/studio/components/interfaces/Support/SupportFormV2.tsx
@@ -66,6 +66,7 @@ import {
SEVERITY_OPTIONS,
} from './Support.constants'
import { formatMessage, uploadAttachments } from './SupportForm.utils'
+import { useRouter } from 'next/router'
const MAX_ATTACHMENTS = 5
const INCLUDE_DISCUSSIONS = ['Problem', 'Database_unresponsive']
@@ -93,6 +94,8 @@ export const SupportFormV2 = ({
message: urlMessage,
error,
} = useParams()
+ const router = useRouter()
+ const dashboardSentryIssueId = router.query.sid as string
const uploadButtonRef = useRef(null)
const [isSubmitting, setIsSubmitting] = useState(false)
@@ -239,6 +242,7 @@ export const SupportFormV2 = ({
.map((x) => x.trim().replace(/ /g, '_').toLowerCase())
.join(';'),
browserInformation: detectBrowser(),
+ ...(dashboardSentryIssueId && { dashboardSentryIssueId }),
}
if (values.projectRef !== 'no-project') {
diff --git a/apps/studio/components/ui/GlobalErrorBoundaryState.tsx b/apps/studio/components/ui/GlobalErrorBoundaryState.tsx
index 87bb6b27f22..92f916d1964 100644
--- a/apps/studio/components/ui/GlobalErrorBoundaryState.tsx
+++ b/apps/studio/components/ui/GlobalErrorBoundaryState.tsx
@@ -15,7 +15,6 @@ import {
} from 'ui'
import { InlineLinkClassName } from './InlineLink'
-// More correct version of FallbackProps from react-error-boundary
export type FallbackProps = {
error: unknown
resetErrorBoundary: (...args: any[]) => void
@@ -31,6 +30,9 @@ export const GlobalErrorBoundaryState = ({ error, resetErrorBoundary }: Fallback
? errorMessage.includes("Failed to execute 'removeChild' on 'Node'")
: false
+ // Get Sentry issue ID from error if available
+ const sentryIssueId = (!!error && typeof error === 'object' && (error as any).sentryId) ?? ''
+
const handleClearStorage = () => {
try {
localStorage.clear()
@@ -67,7 +69,6 @@ export const GlobalErrorBoundaryState = ({ error, resetErrorBoundary }: Fallback
</p>
<p className="text-foreground-light text-sm">{errorMessage}</p>
</div>
-
{isRemoveChildError ? (
<Alert_Shadcn_>
<WarningIcon />
@@ -130,11 +131,10 @@ export const GlobalErrorBoundaryState = ({ error, resetErrorBoundary }: Fallback
</AlertDescription_Shadcn_>
</Alert_Shadcn_>
)}
-
<div className="w-full sm:w-1/2 mx-auto grid grid-cols-2 gap-2">
<Button asChild type="default" icon={<ExternalLink />}>
<Link
- href={`/support/new?category=dashboard_bug&subject=Client%20side%20exception%20occurred%20on%20dashboard&message=${encodeURI(urlMessage)}`}
+ href={`/support/new?category=dashboard_bug${sentryIssueId ? `&sid=${sentryIssueId}` : ''}&subject=Client%20side%20exception%20occurred%20on%20dashboard&message=${encodeURI(urlMessage)}`}
target="_blank"
>
Contact support
diff --git a/apps/studio/data/feedback/support-ticket-send.ts b/apps/studio/data/feedback/support-ticket-send.ts
index 2a6b39cdbac..c981690ccb0 100644
--- a/apps/studio/data/feedback/support-ticket-send.ts
+++ b/apps/studio/data/feedback/support-ticket-send.ts
@@ -17,6 +17,7 @@ export type sendSupportTicketVariables = {
allowSupportAccess: boolean
siteUrl?: string
additionalRedirectUrls?: string
+ dashboardSentryIssueId?: string
}
export async function sendSupportTicket({
@@ -32,6 +33,7 @@ export async function sendSupportTicket({
allowSupportAccess,
siteUrl,
additionalRedirectUrls,
+ dashboardSentryIssueId,
}: sendSupportTicketVariables) {
const { data, error } = await post('/platform/feedback/send', {
body: {
@@ -49,6 +51,7 @@ export async function sendSupportTicket({
affectedServices,
browserInformation,
allowSupportAccess,
+ dashboardSentryIssueId,
},
})
diff --git a/apps/studio/pages/_app.tsx b/apps/studio/pages/_app.tsx
index c1113bbac65..0fafd6944f4 100644
--- a/apps/studio/pages/_app.tsx
+++ b/apps/studio/pages/_app.tsx
@@ -32,7 +32,6 @@ import Head from 'next/head'
import { NuqsAdapter } from 'nuqs/adapters/next/pages'
import { ErrorInfo, useCallback } from 'react'
import { ErrorBoundary } from 'react-error-boundary'
-
import {
FeatureFlagProvider,
getFlags,
@@ -90,7 +89,11 @@ function CustomApp({ Component, pageProps }: AppPropsWithLayout) {
const errorBoundaryHandler = (error: Error, info: ErrorInfo) => {
Sentry.withScope(function (scope) {
scope.setTag('globalErrorBoundary', true)
- Sentry.captureException(error)
+ const eventId = Sentry.captureException(error)
+ // Attach the Sentry event ID to the error object so it can be accessed by the error boundary
+ if (eventId && error && typeof error === 'object') {
+ ;(error as any).sentryId = eventId
+ }
})
console.error(error.stack)