Monitoring
Error tracking with Sentry for the native app and the web app, the server's logs, the sync's health, and uptime checks.
Four things tell you how production is doing:
- Sentry collects errors from the native app and the web app (browser and server rendering), with the user's id, the release and a readable stack trace.
- Logs of the Edge Functions, PowerSync and Postgres, in their containers.
- The replication slot: how far PowerSync is behind Postgres.
/functions/v1/healthfor an uptime monitor.
Sentry is off until you set a DSN: without one, nothing is sent.
Sentry
Create a Sentry project per app and copy its DSN from Project Settings → Client Keys.
| App | Variable | In |
|---|---|---|
| Web app | VITE_SENTRY_DSN | apps/web/.env (public) |
| Native app | EXPO_PUBLIC_SENTRY_DSN | apps/native/.env (public) |
The environment an event belongs to: the native app reports its EAS Update channel (preview,
production), and development from a development build, which has no channel. The web app
reports NODE_ENV. VITE_SENTRY_ENVIRONMENT / EXPO_PUBLIC_SENTRY_ENVIRONMENT override both.
Optional: the share of page loads that are traced, VITE_SENTRY_TRACES_SAMPLE_RATE (default
0).
What's captured
Native app (apps/native/src/lib/sentry.ts): crashes and JavaScript errors, with the user's
id. The SDK has native code, so rebuild the app after adding the DSN the first time. A local
Release build without a Sentry org needs SENTRY_DISABLE_AUTO_UPLOAD=true.
Web app (apps/web/src/instrument.client.ts, instrument.server.ts):
- uncaught errors in the browser, server rendering and server functions;
- errors in route loaders and components (the error page reports what it catches and offers a retry);
- page loads and navigations as traces, with a sample rate above 0;
- a masked replay of sessions that hit an error.
Reports go through a same-origin tunnel, so ad blockers don't drop them.
Only the user's id is sent, never their email or IP address (sendDefaultPii: false).
Readable stack traces
The source map upload needs SENTRY_AUTH_TOKEN in the build environment (EAS for the app, the
Images workflow for the web app): Settings → Auth Tokens, an org token with "Release: Admin".
Never commit it.
The native app names its Sentry org and project in apps/native/app.json, as options of the
@sentry/react-native/expo plugin (birkmdev, listoca-native, on the EU host
https://de.sentry.io/). Its config plugin uploads source maps in EAS builds. An over-the-air
update has its own bundle: after eas update, run bunx sentry-expo-upload-sourcemaps dist in
apps/native with SENTRY_AUTH_TOKEN in your shell.
The web app reads them from the build environment instead, and its Vite plugin uploads the source maps:
SENTRY_AUTH_TOKEN=sntrys_…
SENTRY_ORG=birkmdev
SENTRY_PROJECT=listoca-webLogs
- Edge Functions:
docker logs supabase-edge-functions(self-hosted), or Supabase's dashboard. Handlers log failures with the row or user they concern, never secrets. - PowerSync:
docker compose -f docker-compose.prod.yml logs powersync. Locally: thepowersyncprocess inbun run dev, orbun run sync:logs. Both print one line per event (who connected, how many rows a checkpoint sent and from which streams, confirmed uploads, errors) with each user's email;bun run sync:logs --rawprints the service's JSON. - Postgres: refused writes show up as
ERRORlines with the policy or constraint. Scheduled work is incron.job_run_details.
The sync's health
The admin area's sync page (/admin/sync, Web app) shows the replication
lag, the slot's WAL status and the errors PowerSync reports. PowerSync replicates through a
logical replication slot. If it falls behind or stops, Postgres keeps WAL for it and the disk
fills up. In SQL:
select slot_name, active,
pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn)) as behind
from pg_replication_slots;and set max_slot_wal_keep_size as the safety net.
Uptime
GET https://api.example.com/functions/v1/health returns 200 while the functions and the
database respond. Point an external monitor at it, and at the web app's, the marketing site's
and PowerSync's hosts.
Trying it locally
Set the DSN in the app's .env, start it, and throw in a component or a test route. The events
appear under Issues in Sentry within a few seconds.
Analytics
Page views and product events with Plausible, Umami, PostHog and others, in the web app, the marketing site and the native app, switched by env and consent-aware.
Feature flags
On-off switches with an optional payload, set by admins and synced to every device, so they work offline (the feature-flags part).