-
-
Notifications
You must be signed in to change notification settings - Fork 43
Setup Sentry
Akram El Assas edited this page Jul 4, 2025
·
6 revisions
wexCommerce supports error monitoring through Sentry (https://sentry.io), which captures runtime exceptions and performance metrics. This is useful for diagnosing backend issues in production or staging environments.
- Create a free account at https://sentry.io.
- Create a new Node.js project in Sentry for the wexCommerce backend.
- Copy the provided DSN URL.
Sentry integration is optional and controlled by environment variables in the backend.
WC_ENABLE_SENTRY=true
WC_SENTRY_DSN_BACKEND=https://your_dsn@o0.ingest.sentry.io/your_project_id
WC_SENTRY_TRACES_SAMPLE_RATE=0.1
Do not commit the real DSN to version control.
- When
WC_ENABLE_SENTRY=true
andWC_SENTRY_DSN_BACKEND
is defined, the backend initializes Sentry at startup. - Runtime errors (especially in
try/catch
blocks or unhandled routes) are automatically reported to Sentry. - When
WC_SENTRY_TRACES_SAMPLE_RATE
is is greater than 0, transactions will be sent to Sentry. Sentry will capture performance transactions, showing request duration, slow routes, and trace spans. Set to0
to disable tracing. 0.1 means 10% of transactions will be sent to Sentry. 1 means 100% of transactions will be sent to Sentry. We recommend adjusting this value in production. - The integration complements the existing Winston-based logging system.
To verify Sentry is working:
- Temporarily set
WC_ENABLE_SENTRY=true
and use a real DSN. - Trigger an error in a controller:
throw new Error('Test Sentry integration')
- Check your Sentry dashboard under Issues.
- Sentry is only enabled if both:
WC_ENABLE_SENTRY=true
-
WC_SENTRY_DSN_BACKEND
is set
- You can safely use wexCommerce without Sentry if you prefer other monitoring solutions.
-
backend/src/monitoring/instrument.ts
- Sentry integration and initialization -
backend/src/app.ts
- Sentry Express middleware is attached if enabled -
backend/src/config/logger.ts
- Automatically reports errors to Sentry if enabled
Copyright © Akram El Assas. All rights reserved.
- Overview
- Software Architecture
- Install Guide (Self-hosted)
- Install Guide (Docker)
- Social Login Setup Guide
- Free SSL Setup Guide
- Setup Sentry
- Payment Gateways
- Setup Stripe
- Run from Source
- Run from Source (Docker)
- Fork, Customize, and Sync
- Demo Database
- Change Language and Currency
- Add New Language
- Testing
- Logs
- FAQ
- Release Notes
- Contribution Guide
- Code of Conduct