Skip to content

Commit 68b04a4

Browse files
committed
Expose instrumentSupabase
1 parent 116fca5 commit 68b04a4

File tree

27 files changed

+163
-153
lines changed

27 files changed

+163
-153
lines changed

dev-packages/browser-integration-tests/suites/integrations/supabase/auth/init.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,24 @@ import * as Sentry from '@sentry/browser';
33
import { createClient } from '@supabase/supabase-js';
44
window.Sentry = Sentry;
55

6-
const supabase = createClient('https://test.supabase.co', 'test-key');
6+
const supabaseClient = createClient('https://test.supabase.co', 'test-key');
77

88
Sentry.init({
99
dsn: 'https://[email protected]/1337',
10-
integrations: [Sentry.browserTracingIntegration(), Sentry.supabaseIntegration(supabase)],
10+
integrations: [Sentry.browserTracingIntegration(), Sentry.supabaseIntegration({
11+
supabaseClient
12+
})],
1113
tracesSampleRate: 1.0,
1214
});
1315

1416
// Simulate authentication operations
1517
async function performAuthenticationOperations() {
16-
await supabase.auth.signInWithPassword({
18+
await supabaseClient.auth.signInWithPassword({
1719
1820
password: 'test-password',
1921
});
2022

21-
await supabase.auth.signOut();
23+
await supabaseClient.auth.signOut();
2224
}
2325

2426
performAuthenticationOperations();

dev-packages/browser-integration-tests/suites/integrations/supabase/db-operations/init.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,20 @@ import * as Sentry from '@sentry/browser';
33
import { createClient } from '@supabase/supabase-js';
44
window.Sentry = Sentry;
55

6-
const supabase = createClient(
7-
'https://test.supabase.co',
8-
'test-key'
9-
);
6+
const supabaseClient = createClient('https://test.supabase.co', 'test-key');
107

118
Sentry.init({
129
dsn: 'https://[email protected]/1337',
13-
integrations: [
14-
Sentry.browserTracingIntegration(),
15-
Sentry.supabaseIntegration(supabase)
16-
],
10+
integrations: [Sentry.browserTracingIntegration(), Sentry.supabaseIntegration({ supabaseClient })],
1711
tracesSampleRate: 1.0,
1812
});
1913

2014
// Simulate database operations
2115
async function performDatabaseOperations() {
2216
try {
23-
await supabase
24-
.from('todos')
25-
.insert([{ title: 'Test Todo' }]);
17+
await supabaseClient.from('todos').insert([{ title: 'Test Todo' }]);
2618

27-
await supabase
28-
.from('todos')
29-
.select('*');
19+
await supabaseClient.from('todos').select('*');
3020

3121
// Trigger an error to capture the breadcrumbs
3222
throw new Error('Test Error');

dev-packages/e2e-tests/test-applications/supabase-nextjs/lib/initSupabaseAdmin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const getSupabaseClient = () => {
1515
},
1616
});
1717

18-
Sentry.addIntegration(Sentry.supabaseIntegration(supabaseClient));
18+
Sentry.instrumentSupabase({ supabaseClient });
1919

2020
return supabaseClient;
2121
};

dev-packages/e2e-tests/test-applications/supabase-nextjs/lib/initSupabaseAnon.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const NEXT_PUBLIC_SUPABASE_ANON_KEY =
88

99
export const getSupabaseClient = () => {
1010
const supabaseClient = createClient(NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY);
11-
Sentry.addIntegration(Sentry.supabaseIntegration(supabaseClient));
11+
12+
Sentry.instrumentSupabase({ supabaseClient });
1213

1314
return supabaseClient;
1415
};

dev-packages/e2e-tests/test-applications/supabase-nextjs/pages/api/list-users.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ type Data = {
99
const supabaseClient = getSupabaseClient();
1010

1111
export default async function handler(req: NextApiRequest, res: NextApiResponse<Data>) {
12-
console.debug("###############################3", supabaseClient.auth.admin.listUsers)
1312
const { data, error } = await supabaseClient.auth.admin.listUsers();
1413

1514
if (error) {

dev-packages/e2e-tests/test-applications/supabase-nextjs/sentry.client.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
import * as Sentry from "@sentry/nextjs";
66

77
Sentry.init({
8-
dsn: 'https://public@dsn.ingest.sentry.io/1337',
8+
dsn: 'https://f183f54e7d7d4f018dddaaade1f8481a@o447951.ingest.us.sentry.io/5659328',
99
environment: 'qa', // dynamic sampling bias to keep transactions
1010

1111
// Add optional integrations for additional features
1212
integrations: [
1313
Sentry.replayIntegration(),
1414
],
15-
tunnel: 'http://localhost:3031/', // proxy server
15+
// tunnel: 'http://localhost:3031/', // proxy server
1616

1717
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
1818
tracesSampleRate: 1,

dev-packages/e2e-tests/test-applications/supabase-nextjs/sentry.edge.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
import * as Sentry from "@sentry/nextjs";
66

77
Sentry.init({
8-
dsn: 'https://public@dsn.ingest.sentry.io/1337',
8+
dsn: 'https://f183f54e7d7d4f018dddaaade1f8481a@o447951.ingest.us.sentry.io/5659328',
99
environment: 'qa', // dynamic sampling bias to keep transactions
1010
sendDefaultPii: true,
1111
tracesSampleRate: 1,
12-
tunnel: 'http://localhost:3031/', // proxy server
12+
// tunnel: 'http://localhost:3031/', // proxy server
1313
transportOptions: {
1414
// We expect the app to send a lot of events in a short time
1515
bufferSize: 1000,

dev-packages/e2e-tests/test-applications/supabase-nextjs/sentry.server.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
import * as Sentry from '@sentry/nextjs';
66

77
Sentry.init({
8-
dsn: 'https://public@dsn.ingest.sentry.io/1337',
8+
dsn: 'https://f183f54e7d7d4f018dddaaade1f8481a@o447951.ingest.us.sentry.io/5659328',
99
environment: 'qa', // dynamic sampling bias to keep transactions
1010
tracesSampleRate: 1,
1111
sendDefaultPii: true,
12-
tunnel: 'http://localhost:3031/', // proxy server
12+
// tunnel: 'http://localhost:3031/', // proxy server
1313
transportOptions: {
1414
// We expect the app to send a lot of events in a short time
1515
bufferSize: 1000,

packages/astro/src/index.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ export {
126126
withMonitor,
127127
withScope,
128128
supabaseIntegration,
129+
instrumentSupabase,
129130
zodErrorsIntegration,
130131
profiler,
131132
logger,

packages/aws-serverless/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export {
110110
trpcMiddleware,
111111
updateSpanName,
112112
supabaseIntegration,
113+
instrumentSupabase,
113114
zodErrorsIntegration,
114115
profiler,
115116
amqplibIntegration,

packages/browser/src/index.bundle.tracing.replay.feedback.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export {
1616
setMeasurement,
1717
captureFeedback,
1818
supabaseIntegration,
19+
instrumentSupabase
1920
} from '@sentry/core';
2021

2122
export {

packages/browser/src/index.bundle.tracing.replay.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export {
1515
getSpanDescendants,
1616
setMeasurement,
1717
supabaseIntegration,
18+
instrumentSupabase
1819
} from '@sentry/core';
1920

2021
export {

packages/browser/src/index.bundle.tracing.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export {
1616
getSpanDescendants,
1717
setMeasurement,
1818
supabaseIntegration,
19+
instrumentSupabase
1920
} from '@sentry/core';
2021

2122
export {

packages/browser/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export {
6060
makeMultiplexedTransport,
6161
moduleMetadataIntegration,
6262
supabaseIntegration,
63+
instrumentSupabase,
6364
zodErrorsIntegration,
6465
thirdPartyErrorFilterIntegration,
6566
} from '@sentry/core';

packages/bun/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export {
129129
trpcMiddleware,
130130
updateSpanName,
131131
supabaseIntegration,
132+
instrumentSupabase,
132133
zodErrorsIntegration,
133134
profiler,
134135
amqplibIntegration,

packages/cloudflare/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export {
7676
captureConsoleIntegration,
7777
moduleMetadataIntegration,
7878
supabaseIntegration,
79+
instrumentSupabase,
7980
zodErrorsIntegration,
8081
consoleIntegration,
8182
SEMANTIC_ATTRIBUTE_SENTRY_OP,

packages/core/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export { captureConsoleIntegration } from './integrations/captureconsole';
106106
export { dedupeIntegration } from './integrations/dedupe';
107107
export { extraErrorDataIntegration } from './integrations/extraerrordata';
108108
export { rewriteFramesIntegration } from './integrations/rewriteframes';
109-
export { supabaseIntegration } from './integrations/supabase';
109+
export { supabaseIntegration, instrumentSupabase } from './integrations/supabase';
110110
export { zodErrorsIntegration } from './integrations/zoderrors';
111111
export { thirdPartyErrorFilterIntegration } from './integrations/third-party-errors-filter';
112112
export { consoleIntegration } from './integrations/console';

0 commit comments

Comments
 (0)