Skip to content

Commit cb27fb3

Browse files
add docs for supabase integration (#13545)
Docs for supabase support based on getsentry/sentry-javascript#15436, and adding a coming soon to reference the work here getsentry/sentry-javascript#14611 --------- Co-authored-by: Onur Temizkan <onur@narval.co.uk>
1 parent a000651 commit cb27fb3

File tree

16 files changed

+140
-14
lines changed

16 files changed

+140
-14
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
title: Supabase
3+
description: "Adds instrumentation for Supabase client operations."
4+
supported:
5+
- javascript.browser
6+
- javascript.node
7+
- javascript.aws-lambda
8+
- javascript.azure-functions
9+
- javascript.connect
10+
- javascript.express
11+
- javascript.fastify
12+
- javascript.gcp-functions
13+
- javascript.hapi
14+
- javascript.hono
15+
- javascript.koa
16+
- javascript.nestjs
17+
- javascript.electron
18+
- javascript.nextjs
19+
- javascript.nuxt
20+
- javascript.solidstart
21+
- javascript.sveltekit
22+
- javascript.remix
23+
- javascript.react-router
24+
- javascript.astro
25+
- javascript.bun
26+
- javascript.tanstackstart-react
27+
---
28+
29+
_Import name: `Sentry.supabaseIntegration`_
30+
31+
The `supabaseIntegration` adds instrumentation for the Supabase client to capture spans for both authentication and database operations.
32+
33+
## Installation
34+
35+
You need to have both the Sentry SDK and the Supabase library installed. For Supabase installation instructions, refer to the [Supabase JavaScript documentation](https://supabase.com/docs/reference/javascript/introduction).
36+
37+
38+
## Configuration
39+
40+
This is the preferred method for most use cases. and follows Sentry's standard integration pattern.
41+
42+
```javascript
43+
import * as Sentry from '@sentry/browser';
44+
import { createClient } from '@supabase/supabase-js';
45+
46+
const supabaseClient = createClient('YOUR_SUPABASE_URL', 'YOUR_SUPABASE_KEY');
47+
48+
Sentry.init({
49+
dsn: 'YOUR_DSN',
50+
integrations: [
51+
Sentry.browserTracingIntegration(),
52+
Sentry.supabaseIntegration({ supabaseClient })
53+
],
54+
tracesSampleRate: 1.0,
55+
});
56+
```
57+
58+
## Generated Spans
59+
60+
The integration provides comprehensive monitoring for both authentication and database operations:
61+
62+
### Authentication Spans
63+
64+
The integration automatically instruments the following auth operations:
65+
- `signInWithPassword`
66+
- `signOut`
67+
- `signInAnonymously`
68+
- `signInWithOAuth`
69+
- `signInWithIdToken`
70+
- `signInWithOtp`
71+
- `signInWithSSO`
72+
- `signUp`
73+
- `verifyOtp`
74+
- `reauthenticate`
75+
76+
Admin operations are also instrumented:
77+
- `createUser`
78+
- `deleteUser`
79+
- `listUsers`
80+
- `getUserById`
81+
- `updateUserById`
82+
- `inviteUserByEmail`
83+
84+
### Database Operation Spans
85+
86+
These spans are used to populate Sentry's [Query Insights](/product/insights/backend/queries/) feature, which provides performance metrics and analysis for your database operations. With Query Insights, you can identify slow queries, track query frequency, and optimize your database interactions.
87+
88+
- `db.table`: The table being queried
89+
- `db.schema`: The database schema
90+
- `db.url`: The Supabase instance URL
91+
- `db.sdk`: Client information
92+
- `db.system`: Set to 'postgresql'
93+
- `db.query`: The query parameters
94+
- `db.body`: The request body (for mutations)
95+
96+
### Queue Operation Spans (in progress)
97+
98+
Coming soon, the Sentry SDK will also support generating spans for interactions with Supabase queues. For more information, please follow [this GitHub issue](https://github.com/getsentry/sentry-javascript/issues/14611).
99+
100+
101+
## Error Tracking
102+
103+
The integration automatically:
104+
- Captures errors from failed operations
105+
- Adds breadcrumbs for database operations
106+
- Includes detailed context about the operation that failed
107+
108+
109+
## Supported Versions
110+
111+
- `@supabase/supabase-js`: `>=2.0.0`

platform-includes/configuration/integrations/javascript.astro.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Depending on whether an integration enhances the functionality of a particular r
4040
| [`replayIntegration`](./replay) | | | |||
4141
| [`reportingObserverIntegration`](./reportingobserver) | || | | |
4242
| [`statsigIntegration`](./statsig) | | | | ||
43+
| [`supabaseIntegration`](./supabase) | ||| | |
4344
| [`unleashIntegration`](./unleash) | | | | ||
4445

4546
### Node.js Integrations

platform-includes/configuration/integrations/javascript.bun.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@
3434
| [`knexIntegration`](./knex) | | || |
3535
| [`prismaIntegration`](./prisma) | | || |
3636
| [`rewriteFramesIntegration`](./rewriteframes) | || | |
37+
| [`supabaseIntegration`](./supabase) | ||| | |
3738
| [`trpcMiddleware`](./trpc) | ||||

platform-includes/configuration/integrations/javascript.deno.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414
| [`denoCronIntegration`](./denocron) | | | || |
1515
| [`extraErrorDataIntegration`](./extraerrordata) | | | | ||
1616
| [`rewriteFramesIntegration`](./rewriteframes) | || | | |
17+
| [`supabaseIntegration`](./supabase) | ||| | |
1718
| [`trpcMiddleware`](./trpc) | ||| ||

platform-includes/configuration/integrations/javascript.fastify.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@
3939
| [`nodeProfilingIntegration`](./nodeprofiling) | | || |
4040
| [`prismaIntegration`](./prisma) | | || |
4141
| [`rewriteFramesIntegration`](./rewriteframes) | || | |
42-
| [`trpcMiddleware`](./trpc) | ||||
42+
| [`supabaseIntegration`](./supabase) | ||| | |
43+
| [`trpcMiddleware`](./trpc) | ||||

platform-includes/configuration/integrations/javascript.gatsby.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@
2222
| [`replayIntegration`](./replay) | | | |||
2323
| [`replayCanvasIntegration`](./replaycanvas) | | | || |
2424
| [`reportingObserverIntegration`](./reportingobserver) | || | | |
25+
| [`supabaseIntegration`](./supabase) | ||| | |

platform-includes/configuration/integrations/javascript.gcp-functions.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@
4040
| [`requestDataIntegration`](./requestdata) | | || |
4141
| [`rewriteFramesIntegration`](./rewriteframes) | || | |
4242
| [`tediousIntegration`](./tedious) | | || |
43-
| [`trpcMiddleware`](./trpc) | ||||
43+
| [`trpcMiddleware`](./trpc) | ||||

platform-includes/configuration/integrations/javascript.hapi.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@
3939
| [`nodeProfilingIntegration`](./nodeprofiling) | | || |
4040
| [`prismaIntegration`](./prisma) | | || |
4141
| [`rewriteFramesIntegration`](./rewriteframes) | || | |
42+
| [`supabaseIntegration`](./supabase) | ||| | |
4243
| [`trpcMiddleware`](./trpc) | ||||

platform-includes/configuration/integrations/javascript.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@
2626
| [`reportingObserverIntegration`](./reportingobserver) | || | | |
2727
| [`rewriteFramesIntegration`](./rewriteframes) | || | | |
2828
| [`statsigIntegration`](./statsig) | | | | ||
29+
| [`supabaseIntegration`](./supabase) | ||| | |
2930
| [`unleashIntegration`](./unleash) | | | | ||

platform-includes/configuration/integrations/javascript.nestjs.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,6 @@
3939
| [`nodeProfilingIntegration`](./nodeprofiling) | | || |
4040
| [`prismaIntegration`](./prisma) | | || |
4141
| [`rewriteFramesIntegration`](./rewriteframes) | || | |
42+
| [`supabaseIntegration`](./supabase) | ||| | |
4243
| [`trpcMiddleware`](./trpc) | ||||
44+
| [`unleashIntegration`](./unleash) | | | | ||

0 commit comments

Comments
 (0)