Skip to content

feat: Add Supabase Integration #15719

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 56 commits into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
18cb6b8
feat(core): Add Supabase Integration
onurtemizkan Mar 18, 2025
a6c0d4d
Add missing package exports
onurtemizkan Mar 18, 2025
ab36c16
Remove debug logging
onurtemizkan Mar 18, 2025
9f58b89
Bump next 14 version
onurtemizkan Mar 18, 2025
f37fa5a
Hard-code default development variables
onurtemizkan Mar 18, 2025
68e7774
Add playwright to dev-dependencies.
onurtemizkan Mar 18, 2025
d384cc3
Move `supabase` into its own internal package.
onurtemizkan Mar 18, 2025
4973f04
Add new package reference to Remix integration tests
onurtemizkan Mar 18, 2025
b5ff6db
Update deps
onurtemizkan Mar 19, 2025
38962d1
Separate anon and service clients.
onurtemizkan Mar 19, 2025
dedf54e
Make `supabase` a public package
onurtemizkan Mar 19, 2025
01bf0d6
Add `supabase` to verdaccio config
onurtemizkan Mar 19, 2025
79dd5d7
Remove unused resolutions and dependencies
onurtemizkan Mar 20, 2025
5f00c3c
Move `supabaseIntegration` to `@sentry/core`
onurtemizkan Mar 24, 2025
390744c
Update import paths
onurtemizkan Mar 25, 2025
5b249fb
Fix tests
onurtemizkan Mar 25, 2025
832c4ef
Fix tests
onurtemizkan Mar 25, 2025
fa8199e
Fix formatting
onurtemizkan Mar 25, 2025
5123016
Dedupe dependencies.
onurtemizkan Mar 25, 2025
0e335bd
Skip tests on non-tracing bundles
onurtemizkan Mar 26, 2025
eeaa8a2
Remove test-debug mode
onurtemizkan Mar 26, 2025
adc5e10
Try reducing bundle size
onurtemizkan Mar 26, 2025
cad1352
Remove `supabaseIntegration` from non-Tracing bundles
onurtemizkan Mar 26, 2025
f0d66ce
Bring filter-mappings back.
onurtemizkan Mar 26, 2025
5cb5f58
Export supabase from all tracing bundles
onurtemizkan Mar 26, 2025
16e4a9d
Add vendor license
onurtemizkan Mar 26, 2025
5f67b4a
Clean up
onurtemizkan Mar 27, 2025
318f0a5
Add `auth` support
onurtemizkan Mar 27, 2025
1acde43
Add `auth` error capturing
onurtemizkan Mar 27, 2025
e01ce65
Remove `signOut` from `admin` operations
onurtemizkan Mar 27, 2025
7535386
Clean up
onurtemizkan Mar 31, 2025
0532f8a
Address review comments
onurtemizkan Apr 3, 2025
0ea2cdb
Update packages/core/src/integrations/supabase.ts
onurtemizkan Apr 3, 2025
af31dcf
Remove README.md
onurtemizkan Apr 3, 2025
ace4036
Mark SupabaseConstructor objects as instrumented and check for rewrap…
onurtemizkan Apr 10, 2025
116fca5
Update packages/core/src/integrations/supabase.ts
onurtemizkan Apr 10, 2025
68b04a4
Expose `instrumentSupabase`
onurtemizkan Apr 10, 2025
affaf36
Lint
onurtemizkan Apr 10, 2025
ba7c4e3
Add `db.system` attribute
onurtemizkan Apr 11, 2025
2d8ca55
Update test `dsn`s and tunnel
onurtemizkan Apr 11, 2025
c6ef16f
Update auth `op`s
onurtemizkan Apr 11, 2025
d61aefe
Dedupe deps
onurtemizkan Apr 11, 2025
0c3ff1d
Fix empty arguments on `auth`
onurtemizkan Apr 11, 2025
556703c
Mark and check `auth` as instrumented
onurtemizkan Apr 14, 2025
5776eb7
Rename to `instrumentSupabaseClient` with separate options
onurtemizkan Apr 16, 2025
f081a5d
Remove unnecessary option
Apr 16, 2025
1e87c93
Merge branch 'develop' into onur/supabase-integration
Apr 16, 2025
975d061
tests
Apr 16, 2025
9c2aa4d
woops
Apr 16, 2025
2c638eb
Merge branch 'develop' into onur/supabase-integration
Apr 16, 2025
83902e7
Fix test usage
onurtemizkan Apr 16, 2025
3f5e172
Merge branch 'develop' into onur/supabase-integration
Apr 17, 2025
82043f0
Don't export from browser bundles yet
Apr 17, 2025
d4e3d09
Make types compatible with TS 3.x
onurtemizkan Apr 17, 2025
0ae2ed4
Skip browser bundles on supabase integration tests
onurtemizkan Apr 17, 2025
2f8b5e6
Skip bundle tests per file
onurtemizkan Apr 17, 2025
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
Prev Previous commit
Next Next commit
Fix tests
  • Loading branch information
onurtemizkan committed Apr 14, 2025
commit 5b249fb697b8684a15b88f3d2d0d57eb715c202d
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,46 @@ import type { Event } from '@sentry/core';
import { sentryTest } from '../../../../utils/fixtures';
import { getFirstSentryEnvelopeRequest, getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers';

describe('Supabase Integration', () => {
sentryTest('should capture Supabase database operation breadcrumbs', async ({ getLocalTestUrl, page }) => {
const url = await getLocalTestUrl({ testDir: __dirname });

const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);

expect(eventData.breadcrumbs).toBeDefined();
expect(eventData.breadcrumbs).toContainEqual({
timestamp: expect.any(Number),
type: 'supabase',
category: 'db.insert',
message: 'from(todos)',
data: expect.any(Object),
});
sentryTest('should capture Supabase database operation breadcrumbs', async ({ getLocalTestUrl, page }) => {
const url = await getLocalTestUrl({ testDir: __dirname });

const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);

expect(eventData.breadcrumbs).toBeDefined();
expect(eventData.breadcrumbs).toContainEqual({
timestamp: expect.any(Number),
type: 'supabase',
category: 'db.insert',
message: 'from(todos)',
data: expect.any(Object),
});
});

sentryTest('should capture multiple Supabase operations in sequence', async ({ getLocalTestUrl, page }) => {
const url = await getLocalTestUrl({ testDir: __dirname });
sentryTest('should capture multiple Supabase operations in sequence', async ({ getLocalTestUrl, page }) => {
const url = await getLocalTestUrl({ testDir: __dirname });

const events = await getMultipleSentryEnvelopeRequests<Event>(page, 2, { url });
const events = await getMultipleSentryEnvelopeRequests<Event>(page, 2, { url });

expect(events).toHaveLength(2);
expect(events).toHaveLength(2);

events.forEach(event => {
expect(
event.breadcrumbs?.some(
breadcrumb => breadcrumb.type === 'supabase' && breadcrumb?.category?.startsWith('db.'),
),
).toBe(true);
});
events.forEach(event => {
expect(
event.breadcrumbs?.some(breadcrumb => breadcrumb.type === 'supabase' && breadcrumb?.category?.startsWith('db.')),
).toBe(true);
});
});

sentryTest('should include correct data payload in Supabase breadcrumbs', async ({ getLocalTestUrl, page }) => {
const url = await getLocalTestUrl({ testDir: __dirname });
sentryTest('should include correct data payload in Supabase breadcrumbs', async ({ getLocalTestUrl, page }) => {
const url = await getLocalTestUrl({ testDir: __dirname });

const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);

const supaBreadcrumb = eventData.breadcrumbs?.find(b => b.type === 'supabase');
const supaBreadcrumb = eventData.breadcrumbs?.find(b => b.type === 'supabase');

expect(supaBreadcrumb).toBeDefined();
expect(supaBreadcrumb?.data).toMatchObject({
table: expect.any(String),
operation: expect.any(String),
timestamp: expect.any(Number),
});
expect(supaBreadcrumb).toBeDefined();
expect(supaBreadcrumb?.data).toMatchObject({
table: expect.any(String),
operation: expect.any(String),
timestamp: expect.any(Number),
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test:assert": "pnpm test:prod"
},
"dependencies": {
"@next/font": "14.2.25",
"@next/font": "14.2.15",
"@sentry/nextjs": "latest || *",
"@supabase/auth-helpers-react": "0.5.0",
"@supabase/auth-ui-react": "0.4.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/integrations/supabase.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// eslint-disable max-lines
/* eslint-disable max-lines */
import { logger, isPlainObject } from '../utils-hoist';

import type { Span, IntegrationFn } from '../types-hoist';
Expand Down