Installation
Learn how to install and configure the Traque Node.js SDK for error tracking and monitoring.
Node.js SDK Installation
The Traque Node.js SDK allows you to monitor and track errors in your Node.js applications. This guide will help you get started with installing and configuring the SDK.
Installation
You can install the Traque Node.js SDK using your preferred package manager:
Basic Configuration
After installing the SDK, you need to initialize it in your application:
Configuration Options
The SDK accepts the following configuration options:
Error Capturing
Automatic Error Capturing
The SDK can automatically capture unhandled exceptions and rejections:
Manual Error Capturing
You can also capture errors manually with additional context:
Framework Integration
The SDK seamlessly integrates with popular Node.js web frameworks to capture HTTP context.
Express.js
Fastify
Hono
When using framework integration, the SDK automatically captures:
- Request URL
- HTTP method
- Status code
- Status message
- Client IP address
Best Practices
- Create a single Traque instance and reuse it throughout your application
- Enable automatic capturing in production environments
- Add HTTP context to your error reports when available
- Consider using plugins for additional functionality
Error Handling
The SDK includes built-in error handling features:
- Configuration validation during initialization
- Graceful handling of network errors
- Clear error messages for common issues
- Support for both synchronous and asynchronous error capturing
- Automatic HTTP context capture when available