Skip to content

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

add sentry log to permission query error (#38222)

Jordi Enricb3bae9ec481e
diff --git a/apps/studio/data/permissions/permissions-query.ts b/apps/studio/data/permissions/permissions-query.ts
index 975786dd73b..bad66b84e72 100644
--- a/apps/studio/data/permissions/permissions-query.ts
+++ b/apps/studio/data/permissions/permissions-query.ts
@@ -1,4 +1,5 @@
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
+import * as Sentry from '@sentry/nextjs'
import { useIsLoggedIn } from 'common'
import { get, handleError } from 'data/fetchers'
@@ -10,7 +11,13 @@ export type PermissionsResponse = Permission[]
export async function getPermissions(signal?: AbortSignal) {
const { data, error } = await get('/platform/profile/permissions', { signal })
- if (error) handleError(error)
+ if (error) {
+ handleError(error)
+ Sentry.withScope(function (scope) {
+ scope.setTag('permissions-query-error', true)
+ Sentry.captureException(error)
+ })
+ }
// [Joshen] TODO: Type this properly from the API
return data as unknown as PermissionsResponse