Skip to content

add docs for supabase integration #13545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
title: Supabase
description: "Adds instrumentation for Supabase client operations."
supported:
- javascript.browser
- javascript.node
- javascript.aws-lambda
- javascript.azure-functions
- javascript.connect
- javascript.express
- javascript.fastify
- javascript.gcp-functions
- javascript.hapi
- javascript.hono
- javascript.koa
- javascript.nestjs
- javascript.electron
- javascript.nextjs
- javascript.nuxt
- javascript.solidstart
- javascript.sveltekit
- javascript.remix
- javascript.react-router
- javascript.astro
- javascript.bun
- javascript.tanstackstart-react
---

_Import name: `Sentry.supabaseIntegration`_

The `supabaseIntegration` adds instrumentation for the Supabase client to capture spans for both authentication and database operations.

## Installation

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).


## Configuration

This is the preferred method for most use cases. and follows Sentry's standard integration pattern.

```javascript
import * as Sentry from '@sentry/browser';
import { createClient } from '@supabase/supabase-js';

const supabaseClient = createClient('YOUR_SUPABASE_URL', 'YOUR_SUPABASE_KEY');

Sentry.init({
dsn: 'YOUR_DSN',
integrations: [
Sentry.browserTracingIntegration(),
Sentry.supabaseIntegration({ supabaseClient })
],
tracesSampleRate: 1.0,
});
```

## Generated Spans

The integration provides comprehensive monitoring for both authentication and database operations:

### Authentication Spans

The integration automatically instruments the following auth operations:
- `signInWithPassword`
- `signOut`
- `signInAnonymously`
- `signInWithOAuth`
- `signInWithIdToken`
- `signInWithOtp`
- `signInWithSSO`
- `signUp`
- `verifyOtp`
- `reauthenticate`

Admin operations are also instrumented:
- `createUser`
- `deleteUser`
- `listUsers`
- `getUserById`
- `updateUserById`
- `inviteUserByEmail`

### Database Operation Spans

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.

- `db.table`: The table being queried
- `db.schema`: The database schema
- `db.url`: The Supabase instance URL
- `db.sdk`: Client information
- `db.system`: Set to 'postgresql'
- `db.query`: The query parameters
- `db.body`: The request body (for mutations)

### Queue Operation Spans (in progress)

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).


## Error Tracking

The integration automatically:
- Captures errors from failed operations
- Adds breadcrumbs for database operations
- Includes detailed context about the operation that failed


## Supported Versions

- `@supabase/supabase-js`: `>=2.0.0`
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Depending on whether an integration enhances the functionality of a particular r
| [`replayIntegration`](./replay) | | | | ✓ | ✓ |
| [`reportingObserverIntegration`](./reportingobserver) | | ✓ | | | |
| [`statsigIntegration`](./statsig) | | | | | ✓ |
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | | |
| [`unleashIntegration`](./unleash) | | | | | ✓ |

### Node.js Integrations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@
| [`knexIntegration`](./knex) | | | ✓ | |
| [`prismaIntegration`](./prisma) | | | ✓ | |
| [`rewriteFramesIntegration`](./rewriteframes) | | ✓ | | |
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
| [`denoCronIntegration`](./denocron) | | | | ✓ | |
| [`extraErrorDataIntegration`](./extraerrordata) | | | | | ✓ |
| [`rewriteFramesIntegration`](./rewriteframes) | | ✓ | | | |
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@
| [`nodeProfilingIntegration`](./nodeprofiling) | | | ✓ | |
| [`prismaIntegration`](./prisma) | | | ✓ | |
| [`rewriteFramesIntegration`](./rewriteframes) | | ✓ | | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
| [`replayIntegration`](./replay) | | | | ✓ | ✓ |
| [`replayCanvasIntegration`](./replaycanvas) | | | | ✓ | |
| [`reportingObserverIntegration`](./reportingobserver) | | ✓ | | | |
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | | |
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
| [`requestDataIntegration`](./requestdata) | | | ✓ | |
| [`rewriteFramesIntegration`](./rewriteframes) | | ✓ | | |
| [`tediousIntegration`](./tedious) | | | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@
| [`nodeProfilingIntegration`](./nodeprofiling) | | | ✓ | |
| [`prismaIntegration`](./prisma) | | | ✓ | |
| [`rewriteFramesIntegration`](./rewriteframes) | | ✓ | | |
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@
| [`reportingObserverIntegration`](./reportingobserver) | | ✓ | | | |
| [`rewriteFramesIntegration`](./rewriteframes) | | ✓ | | | |
| [`statsigIntegration`](./statsig) | | | | | ✓ |
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | | |
| [`unleashIntegration`](./unleash) | | | | | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@
| [`nodeProfilingIntegration`](./nodeprofiling) | | | ✓ | |
| [`prismaIntegration`](./prisma) | | | ✓ | |
| [`rewriteFramesIntegration`](./rewriteframes) | | ✓ | | |
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`unleashIntegration`](./unleash) | | | | | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Depending on whether an integration enhances the functionality of a particular r
| [`replayIntegration`](./replay) | | | | ✓ | ✓ |
| [`reportingObserverIntegration`](./reportingobserver) | | ✓ | | | |
| [`statsigIntegration`](./statsig) | | | | | ✓ |
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | | |
| [`unleashIntegration`](./unleash) | | | | | ✓ |

### Server (Node.js, Edge) Integrations
Expand Down
25 changes: 13 additions & 12 deletions platform-includes/configuration/integrations/javascript.node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,40 @@
| | **Auto Enabled** | **Errors** | **Tracing** | **Additional Context** |
| --------------------------------------------------------- | :--------------: | :--------: | :---------: | :--------------------: |
| [`amqplibIntegration`](./amqplib) | ✓ | | ✓ | |
| [`anrIntegration`](./anr) | | ✓ | | |
| [`captureConsoleIntegration`](./captureconsole) | | | | ✓ |
| [`childProcessIntegration`](./childProcess) | ✓ | | | ✓ |
| [`consoleIntegration`](./console) | ✓ | | | ✓ |
| [`contextLinesIntegration`](./contextlines) | ✓ | ✓ | | |
| [`dataloaderIntegration`](./dataloader) | | | ✓ | |
| [`dedupeIntegration`](./dedupe) | ✓ | ✓ | | |
| [`extraErrorDataIntegration`](./extraerrordata) | | | | ✓ |
| [`fsIntegration`](./fs) | | | ✓ | |
| [`functionToStringIntegration`](./functiontostring) | ✓ | | | |
| [`genericPoolIntegration`](./genericpool) | ✓ | | ✓ | |
| [`graphqlIntegration`](./graphql) | ✓ | | ✓ | |
| [`httpIntegration`](./http) | ✓ | ✓ | ✓ | ✓ |
| [`inboundFiltersIntegration`](./inboundfilters) | ✓ | ✓ | | |
| [`kafkaIntegration`](./kafka) | ✓ | | ✓ | |
| [`knexIntegration`](./knex) | | | ✓ | |
| [`linkedErrorsIntegration`](./linkederrors) | ✓ | ✓ | | |
| [`localVariablesIntegration`](./localvariables) | | ✓ | | |
| [`lruMemoizerIntegration`](./lrumemoizer) | ✓ | | ✓ | |
| [`modulesIntegration`](./modules) | ✓ | | | ✓ |
| [`mongoIntegration`](./mongo) | ✓ | | ✓ | |
| [`mongooseIntegration`](./mongoose) | ✓ | | ✓ | |
| [`mysqlIntegration`](./mysql) | ✓ | | ✓ | |
| [`mysql2Integration`](./mysql2) | ✓ | | ✓ | |
| [`nodeContextIntegration`](./nodecontext) | ✓ | | | ✓ |
| [`nativeNodeFetchIntegration`](./nodefetch) | ✓ | | ✓ | ✓ |
| [`nodeContextIntegration`](./nodecontext) | ✓ | | | ✓ |
| [`nodeProfilingIntegration`](./nodeprofiling) | | | ✓ | |
| [`onUncaughtExceptionIntegration`](./onuncaughtexception) | ✓ | ✓ | | |
| [`onUnhandledRejectionIntegration`](./unhandledrejection) | ✓ | ✓ | | |
| [`postgresIntegration`](./postgres) | ✓ | | ✓ | |
| [`prismaIntegration`](./prisma) | | | ✓ | |
| [`redisIntegration`](./redis) | ✓ | | ✓ | |
| [`requestDataIntegration`](./requestdata) | ✓ | | ✓ | |
| [`tediousIntegration`](./tedious) | ✓ | | ✓ | |
| [`childProcessIntegration`](./childProcess) | ✓ | | | ✓ |
| [`anrIntegration`](./anr) | | ✓ | | |
| [`captureConsoleIntegration`](./captureconsole) | | | | ✓ |
| [`dataloaderIntegration`](./dataloader) | | | ✓ | |
| [`extraErrorDataIntegration`](./extraerrordata) | | | | ✓ |
| [`fsIntegration`](./fs) | | | ✓ | |
| [`knexIntegration`](./knex) | | | ✓ | |
| [`localVariablesIntegration`](./localvariables) | | ✓ | | |
| [`nodeProfilingIntegration`](./nodeprofiling) | | | ✓ | |
| [`prismaIntegration`](./prisma) | | | ✓ | |
| [`rewriteFramesIntegration`](./rewriteframes) | | ✓ | | |
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | |
| [`tediousIntegration`](./tedious) | ✓ | | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Depending on whether an integration enhances the functionality of a particular r
| [`replayIntegration`](./replay) | | | | ✓ | ✓ |
| [`reportingObserverIntegration`](./reportingobserver) | | ✓ | | | |
| [`statsigIntegration`](./statsig) | | | | | ✓ |
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | | |
| [`unleashIntegration`](./unleash) | | | | | ✓ |

### Node.js Integrations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Depending on whether an integration enhances the functionality of a particular r
| [`replayIntegration`](./replay) | | | | ✓ | ✓ |
| [`reportingObserverIntegration`](./reportingobserver) | | ✓ | | | |
| [`statsigIntegration`](./statsig) | | | | | ✓ |
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | | |
| [`unleashIntegration`](./unleash) | | | | | ✓ |

### Node.js Integrations
Expand Down
Loading