@runtimevault/node
v1.0.4
Published
RuntimeVault Node.js SDK — capture server-side errors and send runtime snapshots
Maintainers
Readme
@runtimevault/node
Server-side RuntimeVault SDK for Node.js. Captures uncaught exceptions and unhandled rejections, and lets you manually report errors to the same snapshot pipeline as the browser SDK.
Install
npm install @runtimevault/nodeQuick start
import { RuntimeVault } from '@runtimevault/node';
RuntimeVault.init({
apiKey: process.env.RUNTIMEVAULT_API_KEY!, // rv_live_...
environment: process.env.NODE_ENV || 'production',
projectId: 'default',
release: process.env.npm_package_version,
});
// Manual capture
try {
await riskyJob();
} catch (err) {
await RuntimeVault.captureException(err, { context: { job: 'billing.sync' } });
throw err;
}Express example
import express from 'express';
import { RuntimeVault } from '@runtimevault/node';
RuntimeVault.init({ apiKey: process.env.RUNTIMEVAULT_API_KEY! });
const app = express();
app.get('/boom', () => {
throw new Error('express smoke test');
});
app.use(async (err, _req, res, _next) => {
await RuntimeVault.captureException(err, { handled: true });
res.status(500).json({ error: 'internal' });
});API
| Method | Description |
|---|---|
| RuntimeVault.init(config) | Install process handlers once |
| RuntimeVault.captureException(error, opts?) | Send a snapshot |
| RuntimeVault.captureMessage(msg, opts?) | Capture a message as an error |
Links
License
MIT
