@errortracking/server-sdk
v0.1.2
Published
Error tracking SDK for Express apps
Downloads
335
Maintainers
Readme
@errortracking/server-sdk
Error tracking SDK for Node.js and Express apps. Catches uncaught errors and sends them to your Error Tracker dashboard with the exact file, line, and surrounding source code that caused each error.
Install
npm install @errortracking/server-sdkSetup
Get your project API key from the Error Tracker dashboard (it looks like
et_live_...).
Call init once at the very top of your app's entry file, before any routes:
import { init } from "@errortracking/server-sdk";
init({
apiKey: "et_live_your_key_here",
apiUrl: "https://error-tracking-server.onrender.com",
});Then add errorHandler after all your routes:
import { errorHandler } from "@errortracking/server-sdk";
app.get("/", (req, res) => { /* your routes */ });
app.use(errorHandler); // must be lastThat is all. The project shows as Connected on startup, and errors start flowing into your dashboard.
What it catches
- Uncaught exceptions (
process.on("uncaughtException")) -- captured viainit - Unhandled promise rejections (
process.on("unhandledRejection")) -- captured viainit - Express errors passed via
next(err)-- captured viaerrorHandler
The errorHandler middleware records the route, HTTP method, and status code
alongside the error, then calls next(err) so your own error responses still
work normally.
Code context (no source maps needed)
For each error, the SDK reads the source file directly from disk and sends the
lines around the failing line to the dashboard. Because Node.js runs your actual
.js files, there is no need to upload source maps for server-side code. The
dashboard shows your real code out of the box.
Options
| Option | Required | Default | Description |
| -------- | -------- | ------------------------- | ------------------------------------ |
| apiKey | yes | | Your project API key (et_live_...) |
| apiUrl | no | http://localhost:5000 | Your Error Tracker backend URL |
Notes
- Sending errors never crashes your app. All network calls fail silently.
- On an uncaught exception the SDK sends the error and exits the process after at most 2 seconds, matching standard Node.js behavior.
