Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.shipnative.app/llms.txt

Use this file to discover all available pages before exploring further.

Shipnative uses Sentry for error tracking and performance monitoring.

Setup

yarn setup
The wizard prompts for your Sentry DSN. Or manually add to apps/app/.env:
EXPO_PUBLIC_SENTRY_DSN=https://key@sentry.io/project-id
Without DSN: Errors log to console. Connect Sentry early to catch errors with full stack traces and context.

Usage

Track Errors

import { trackError } from '@/utils/analytics'

try {
  // risky code
} catch (error) {
  trackError(error as Error, {
    tags: { screen: 'Checkout', action: 'payment' },
    extra: { amount: 99.99 },
  })
}

Log Messages

import { trackMessage } from '@/utils/analytics'

trackMessage('User completed onboarding', 'info')
trackMessage('API rate limit approaching', 'warning')

User Context

import { setUserContext, clearUserContext } from '@/utils/analytics'

// After login
setUserContext({ id: 'user-123', email: 'user@example.com' })

// After logout
clearUserContext()
import { addBreadcrumb } from '@/utils/analytics'

addBreadcrumb({
  category: 'navigation',
  message: 'Navigated to Settings',
})

Direct Sentry Access

import { sentry } from '@/services/sentry'

sentry.captureException(new Error('Something went wrong'))
sentry.captureMessage('Info message', 'info')

Testing

Mock mode: Errors log to console as [MockSentry] Exception: ... Real Sentry:
  1. Add DSN to .env
  2. Trigger an error: throw new Error('Test error')
  3. View in Sentry Dashboard → Issues

Troubleshooting

Errors not showing in Sentry?
  • Verify DSN is correct
  • Check network connectivity
  • Allow a few seconds for upload
Still in mock mode?
  • Verify apps/app/.env has EXPO_PUBLIC_SENTRY_DSN
  • Restart Metro: yarn start --clear
For more, see Sentry React Native SDK.