Skip to content
bliptracedocs

Install an SDK

Express

Error-handling middleware for Express that reports errors with request context and then passes them on.

On this page

@g8scope/express is error-handling middleware over @g8scope/js. It builds an envelope with the request context, sends it without waiting, and calls next(err) so your own error handling still runs.

Install from GitHub. Not on npm yet, and both repositories must be built. Clone them side by side (the adapter refers to ../bliptrace-js). Sources: bliptrace-js, bliptrace-express.

Install

git clone https://github.com/bliptrace/bliptrace-js
git clone https://github.com/bliptrace/bliptrace-express
(cd bliptrace-js && npm install && npm run build && npm pack)
(cd bliptrace-express && npm install && npm run build && npm pack)
# then, in your app (install both tarballs in one command):
npm install /path/to/bliptrace-js/g8scope-js-1.0.0.tgz /path/to/bliptrace-express/g8scope-express-1.0.0.tgz

Use it

Register it last, after all routes:

import express from 'express';
import { g8scopeErrorHandler } from '@g8scope/express';

const app = express();

// ... your routes ...

app.use(g8scopeErrorHandler({
  key: process.env.BLIPTRACE_KEY,
  endpoint: 'https://ingest.bliptrace.com',
  environment: process.env.NODE_ENV,
  release: process.env.BLIPTRACE_RELEASE,
}));

Every @g8scope/js option is accepted (basePath, scrubKeys, ignoreExceptions, timeout, enabled, …).

Each report includes request.method, request.url, the headers without authorization and cookie, and user.id when an auth layer has set req.user.

Documentation