Skip to content
betterstack-alchemyUnofficial

Releases & integrations

A Release registers a version of an application, and the environments it was deployed to. The release appears the moment it deploys, before the first event that carries it, and errors can be resolved “in the current release”. Your service reports the same version with SENTRY_RELEASE, or release in Sentry.init, so its events land on it.

alchemy.run.ts
yield* BetterStack.Errors.Release("v1", {
applicationId: errors.id,
version: "v1.2.3",
environment: ["production"],
});

The API has no update: changing version, applicationId, environment or teamId replaces the release. Destroying it keeps its errors.

Errors.RegisterRelease registers a release from a deploy pipeline or a release job. The DSN can only report events, so this needs an API token, which you pass explicitly; use a team-scoped Errors API token:

src/release.ts
import * as BetterStack from "betterstack-alchemy";
import * as Effect from "effect/Effect";
import * as HttpServerResponse from "effect/http/HttpServerResponse";
import { Box, Errors } from "./shared.ts";
const ErrorsToken = BetterStack.apiTokenFromConfig("BETTERSTACK_ERRORS_TOKEN");
export default class Releaser extends BetterStack.Cloud.Service<Releaser>()(
"Releaser",
{ server: Box, main: import.meta.url, port: 3000 },
Effect.gen(function* () {
const register = yield* BetterStack.Errors.RegisterRelease(Errors, ErrorsToken);
return {
fetch: Effect.gen(function* () {
const release = yield* register({ version: "1.4.2", environment: ["production"] });
return yield* HttpServerResponse.json({ version: release.version ?? null });
}).pipe(Effect.orDie),
};
}).pipe(Effect.provide(BetterStack.Errors.RegisterReleaseHttp)),
) {}

Provide RegisterReleaseHttp on the host’s implementation. The binding is tested against the offline mock only; see Compatibility.

Error tracking has its own integrations for Slack, Jira, Linear and Microsoft Teams. Each is connected once in the Better Stack web app, because it needs the other service’s OAuth consent; the API can’t create or delete one. Name it by integrationId, and the resource takes over its settings: which applications, which errors, how updates are posted. Destroying the resource only forgets it.

alchemy.run.ts
yield* BetterStack.Errors.SlackIntegration("slack", {
integrationId: "12345",
applications: [{ applicationId: errors.id, environments: ["production"] }],
postUpdates: "thread_based",
occurrenceThresholdCount: 50,
occurrenceThresholdInterval: "hour",
});

notifications is merged by the API: only the toggles you declare are sent and compared, the others keep their values. A missing integrationId fails the deploy.

Resource Configures
SlackIntegration the channel that gets error notifications, which errors reach it, how updates are posted
JiraIntegration which errors are filed as Jira work items, in which space, with which type and fields
LinearIntegration which errors are filed as Linear issues, and how errors and issues are kept in sync
MicrosoftTeamsIntegration which errors reach which channels of the team the Better Stack app was added to

These take-over resources are tested against the offline mock only.