Sentry - TundraSoft/tundra-connect GitHub Wiki
Sentry
Typed client for Sentry's organization and project REST
API (https://sentry.io/api/0/) for Deno, Bun,
Node.js and Cloudflare Workers. List projects; list, fetch and update issues;
read issue events; and create releases. This is the management API. To capture
and report errors, use Sentry's own SDKs.
Overview
Sentry is an error-tracking and performance-monitoring platform. This connect covers reading and triaging issues (list/get/update, plus an issue's raw events), listing projects, and publishing releases against Sentry's organization-scoped REST API. It uses RESTler for transport and Guardian for runtime request/response validation.
It does not implement the separate DSN-based event-ingestion protocol (the semi-binary envelope format an SDK uses to report a new error/exception into Sentry) — that's architecturally foreign to this connect's request/response client pattern and out of scope here.
import { Sentry } from '@tundraconnect/sentry';
const client = new Sentry({
auth: { type: 'BEARER', token: 'sntrys_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' },
organization: 'my-org',
});
Testing your code
Your tests don't need to fake HTTP. Have your code take a Sentry instance
and pass in a stand-in that returns the shapes from
@tundraconnect/sentry/schemas or throws a real SentryError:
import { SentryError } from '@tundraconnect/sentry/errors';
const outage = new SentryError('SERVICE_UNAVAILABLE', { status: 503 });
console.log(outage.code);
To exercise the client itself against a fake transport, subclass it and
reassign the protected _fetch.
Documentation
| Topic | Description |
|---|---|
| API | Client configuration and endpoint methods |
| Errors | Error codes and diagnostic metadata |
| Schemas | Public Guardian schemas and inferred types |
Upstream
Installation
Deno:
deno add jsr:@tundraconnect/sentry
Bun:
bunx jsr add @tundraconnect/sentry
Node.js:
npx jsr add @tundraconnect/sentry
Quick Start
import { Sentry } from '@tundraconnect/sentry';
const client = new Sentry({
auth: { type: 'BEARER', token: 'sntrys_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' },
organization: 'my-org',
});
const { issues } = await client.listIssues({ query: 'is:unresolved' });
for (const issue of issues) {
console.log(issue.shortId, issue.title, issue.level);
}
License
MIT. Part of Tundra Connect, typed vendor API clients for Deno, Bun, Node.js and Cloudflare Workers.