Supabase for Flutter
Correlate Sentry traces with Supabase logs in your Flutter app.
The Sentry Dart/Flutter SDK can attach W3C traceparent to Supabase API requests. Supabase stamps that trace ID onto API Gateway and Edge Function logs, so you can join a client span to the server logs it produced. This requires sentry or sentry_flutter ≥9.7.0.
Enable propagateTraceparent and pass SentryHttpClient into Supabase. The Dart SDK does not intercept HTTP globally, so the option has no effect on a default SupabaseClient.
Copied
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
await SentryFlutter.init((options) {
options.dsn = '___PUBLIC_DSN___';
options.tracesSampleRate = 1.0;
options.propagateTraceparent = true;
});
await Supabase.initialize(
url: 'https://xyzcompany.supabase.co',
anonKey: 'your-anon-key',
httpClient: SentryHttpClient(),
);
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
await SentryFlutter.init((options) {
options.dsn = '___PUBLIC_DSN___';
options.tracesSampleRate = 1.0;
options.propagateTraceparent = true;
});
await Supabase.initialize(
url: 'https://xyzcompany.supabase.co',
anonKey: 'your-anon-key',
httpClient: SentryHttpClient(),
);
Combined with Supabase Log Drains, those logs show up on the Sentry trace.
If you inject headers from the Supabase client instead of Sentry’s HTTP layer, use TracePropagationOptions. That path does not use propagateTraceparent.
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").