Skip to content

Commit abf6257

Browse files
authored
Reinstate captureException in SessionTimeoutModal with lowered quota usage (supabase#37925)
1 parent 7a35ad3 commit abf6257

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

apps/studio/components/interfaces/SignIn/SessionTimeoutModal.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import * as Sentry from '@sentry/nextjs'
2+
import { useEffect } from 'react'
3+
14
import { InlineLink } from 'components/ui/InlineLink'
25
import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'
36

@@ -12,6 +15,12 @@ export const SessionTimeoutModal = ({
1215
onClose,
1316
redirectToSignIn,
1417
}: SessionTimeoutModalProps) => {
18+
useEffect(() => {
19+
if (visible) {
20+
Sentry.captureException(new Error('Session error detected'))
21+
}
22+
}, [visible])
23+
1524
return (
1625
<ConfirmationModal
1726
visible={visible}

apps/studio/instrumentation-client.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,12 @@ Sentry.init({
6363
const isInvalidUrlEvent = (hint.originalException as any)?.message?.includes(
6464
`Failed to construct 'URL': Invalid URL`
6565
)
66+
// [Joshen] Similar behaviour for this error from SessionTimeoutModal to control the quota usage
67+
const isSessionTimeoutEvent = (hint.originalException as any)?.message.includes(
68+
'Session error detected'
69+
)
6670

67-
if (isInvalidUrlEvent && Math.random() > 0.01) {
71+
if ((isInvalidUrlEvent || isSessionTimeoutEvent) && Math.random() > 0.01) {
6872
return null
6973
}
7074

0 commit comments

Comments
 (0)