Installation
Version Compatibility
- Nuxt 3.14+: Recommended
- Nuxt 3.7+: Minimum supported version
- Vue 3: Required
- Works with both SSR and static generation
Basic Setup
Client Configuration
Createsentry.client.config.ts in your project root:
Server Configuration
Createsentry.server.config.ts in your project root:
Error Handling
Component Errors
Vue component errors are automatically captured:Server Routes
API Routes with Spans
Composables and Plugins
Custom Error Handler Plugin
Composable with Tracking
Server Middleware
Performance Monitoring
Page Navigation
Page navigation is automatically tracked when the Sentry module is configured.Custom Spans
Database Queries
Context and User Information
Setting User Context
Adding Context
Runtime Config
Use Nuxt runtime config for environment variables:Source Maps
Configure source maps upload innuxt.config.ts:
Environment Variables
Create a.env file:
Deployment
- Vercel
- Netlify
- Cloudflare Pages
- Self-Hosted
Add environment variables in Vercel:
SENTRY_DSNSENTRY_AUTH_TOKENSENTRY_ENVIRONMENT
Best Practices
Module Configuration
Add Sentry module to nuxt.config.ts for automatic setup.
Separate Configs
Use separate config files for client and server initialization.
Runtime Config
Use Nuxt runtime config for environment-specific values.
Source Maps
Always configure source maps upload for production.
Troubleshooting
Module Not Loading
Module Not Loading
Ensure:
@sentry/nuxt/moduleis in the modules array- Config files are in the project root
- DSN is correctly set
Source Maps Not Uploaded
Source Maps Not Uploaded
Verify:
SENTRY_AUTH_TOKENis setsourceMapsUploadOptionsis configured- Check build output for upload logs
Errors Not Captured
Errors Not Captured
Check:
- Both client and server configs are initialized
- DSN is the same in both configs
- Network requests to Sentry are not blocked
Next Steps
Server Routes
Monitor API endpoints and server functions
Composables
Track custom composables and utilities
Session Replay
Debug with session recordings
Vue Integration
Advanced Vue-specific features