Skip to content
Türkçe

Introducing Magic Sentry 1.0.1

Know what broke before your users tell you.

Sentry error and performance monitoring for the Magic framework: a web-safe boot, the HTTP failures Http swallows, the signed-in user and breadcrumbs from your events.

Runs on

  • Android
  • iOS
  • Web
  • macOS
  • Windows
  • Linux

Wired into Magic. Nothing to glue.

Sentry knows nothing about the Magic Http facade, its auth state or its router. Magic Sentry connects them so the reports carry the context you need.

Web-safe boot

MagicSentry.run opens one guarded zone and starts Sentry before Magic.init, so a failure during boot is reported.

  • MagicSentry.run must be the whole body of main()
  • A second zone breaks the binding on web, so Magic.init goes inside appRunner
Read the docs
void main() {
  MagicSentry.run(configure: configureSentry, appRunner: _boot);
}

HTTP failures

The Http facade never throws, so Magic Sentry reports a 5xx or a dead connection as an event and a 4xx as a breadcrumb.

  • Status 0 and 500 and above file an event; 401, 404 and 422 are breadcrumbs
  • One failure is one event per session; the repeats become breadcrumbs
Read the docs
Future<void> loadMonitors() async {
  final MagicResponse response = await Http.get('/monitors');

  if (!response.successful) {
    // Already reported by the interceptor; handle it for the user.
  }
}

Signed-in user

The Sentry scope user follows Auth.stateNotifier, with your own id, email and extras.

  • Auth.stateNotifier drives it, so logout clears the user
  • userId must return a String: Model.id is dynamic and often an int
Read the docs
final List<Object> providers = [
  (app) => SentryServiceProvider<User>(
    app,
    userId: (user) => user.id?.toString() ?? '',
    userEmail: (user) => user.email,
    userExtras: (user) => {'plan': user.plan},
  ),
];

Event breadcrumbs

Any Magic event that implements ReportsBreadcrumb becomes a breadcrumb.

  • A MagicEvent that also implements ReportsBreadcrumb needs no extra wiring
  • Keep secrets out of breadcrumbData: it is sent as written, apart from token masking
Read the docs

Navigation trail

A navigator observer on MagicRouter records where the user was and, with named routes, feeds release health.

  • The installer registers SentryServiceProvider in lib/config/app.dart
  • The observer must be added before the router builds its config, hence providers
Read the docs

Token scrubbing

SentryTokenScrubber masks tokens that travel in URLs before an event leaves the app.

  • Query values whose key has token, password, secret and more become [Filtered]
  • It only masks, never drops, and fails closed if the scrubber throws
Read the docs
platforms
6
commands to install
2
license
MIT

Your agent speaks Magic Sentry.

The Magic Sentry skill teaches your coding assistant to wire the service provider and the boot the way the framework expects, before the first line. One command wires it up.

npx skills add anilcancakir/ai --skill magic-sentry

run in your project other editors

works with

  • Claude Code
  • Cursor
  • OpenCode
  • VS Code Copilot
  • Codex CLI

And checks the docs.

Skills teach the wiring. The MCP server at mcp.anilcancakir.com/magic_sentry gives your agent live docs lookup while it edits, so it never guesses a signature.

  • Streamable HTTP

    One endpoint, every client.

  • search-docs

    Live query against the source.

  • Public, no auth

    Read-only, free to use.

Connect your editor
mcp.anilcancakir.com/magic_sentry preview

# streamable http, the default

claude mcp add --transport http magic_sentry https://mcp.anilcancakir.com/magic_sentry

# or stdio, for clients without http

npx -y mcp-remote https://mcp.anilcancakir.com/magic_sentry

Public, no auth.

Questions, answered.

What people ask before they add Magic Sentry to a Flutter app.

What is Magic Sentry?

Magic Sentry is the Sentry plugin for Magic apps. One MagicSentry.run call starts Sentry before Magic.init, reports the HTTP failures the Http facade swallows, follows the signed-in user and masks URL-borne tokens.

How do I install Magic Sentry?

Run flutter pub add magic_sentry, then dart run magic:dowel plugin:install magic_sentry. The installer publishes lib/config/sentry.dart and registers SentryServiceProvider; it cannot rewrite main(), so wrap it in MagicSentry.run yourself.

Which platforms does Magic Sentry support?

Wherever sentry_flutter 10 runs: iOS 15+, Android minSdk 24+, macOS 12+, web, Windows and Linux. MagicSentry.run opens one zone, which is what makes Flutter web safe.

Does Magic Sentry need a Sentry DSN?

Set SENTRY_DSN in .env. Without one the SDK is inert: appRunner still runs and every other part of Magic Sentry does nothing, so local runs and tests stay quiet.

Does Magic Sentry report 4xx responses?

Not as issues. A 0 (no response) or a 500 and above opens an event, while a 401, 404 or 422 becomes a breadcrumb on the next event.

Does Magic Sentry work with AI coding agents?

Yes. Magic Sentry ships an agent skill that teaches your assistant the boot order, the service provider and the HTTP and user context wiring, plus a public docs MCP server for live lookup.

Is Magic Sentry open source?

Yes. Magic Sentry is open source under the MIT license.

Add it in seconds

~/my_app
flutter pub add magic_sentry

Or add to pubspec.yaml:

dependencies:
  magic_sentry: ^1.0.1

Or give your AI agent this prompt:

Read https://anilcancakir.com/magic/docs/sentry/llms.txt and install the Magic Sentry package in this project.