[BugSink](https://www.bugsink.com/) is a self-hosted, Sentry-API-compatible error tracker. Because the wire protocol matches Sentry's, DeployHQ does not need a separate BugSink integration — you configure a **Sentry** integration in DeployHQ and point it at your BugSink installation URL. The same single integration drives both:

- **Deploy notifications** — DeployHQ posts a release + deploy entry to BugSink whenever a deployment finishes.
- **Post-deploy error monitoring** — if you add an [Error monitoring deployment check](error-monitoring-checks), DeployHQ queries BugSink for new issues attributable to the release.

## Prerequisites

- A running BugSink instance reachable from DeployHQ's deployment workers (cloud DeployHQ talks to the public IP / DNS name of your BugSink host).
- A BugSink project to deploy into.
- A BugSink **Personal Auth Token** (or equivalent — BugSink calls them by the Sentry name). The token needs:
  - `project:releases` — required for the deploy-notification flow.
  - `project:read` and `event:read` — required if you also enable the post-deploy Error monitoring check. Without them the watch returns a clear "token lacks event:read scope" error in the deploy log.

## Set up the integration

Click **Integrations** in your project sidebar, then **New Integration**.

Select **Sentry** in the service picker, then choose **On-premise** when prompted for the version. Fill in:

- **Project Slug** — the BugSink project's slug (visible in the BugSink URL when you view the project).
- **Organization Slug** — your BugSink organization slug (the part of the URL after `/organizations/` in your BugSink installation).
- **Installation URL** — the base URL of your BugSink installation, e.g. `https://bugsink.your-company.com`. Do not include a trailing slash.
- **Environment** — the environment label DeployHQ tags releases with, e.g. `production` or `staging`. This also drives the Error monitoring watch's environment filter.
- **Auth Token** — paste the BugSink Personal Auth Token described above.

Choose when to trigger the integration (typically on **deployment completed**) and which servers it applies to.

Click **Create Integration**.

## Add post-deploy error monitoring (optional)

To have DeployHQ automatically watch BugSink for new issues after each deploy:

1. Open the project's **Deployment Checks** page.
2. Click **New Check**, pick **Post-deploy**, then **Error monitoring**.
3. Select the BugSink integration you just created.
4. Pick a window (10, 30, or 60 minutes), a minimum severity, and whether to **Match by release tag** (recommended if your application's SDK reports `release` as the deployed commit SHA — see below).
5. Save.

On the next deploy, DeployHQ schedules a watch for that window. When the window elapses, the deployment page shows either "No new errors during the watch window." or a list of new issues with direct links into BugSink.

## Tightening the correlation with release tags

The watch's strongest signal is `firstSeen > deployment.finished_at` — issues that first appeared after the deploy. To tighten it further, configure your application's SDK to set the **release** to the commit SHA DeployHQ deployed (`SENTRY_RELEASE` env var for the Sentry SDK, which BugSink ingests identically). Then tick **Match by release tag** on the check; only issues tagged with this exact deploy's SHA will surface.

## Troubleshooting

- **"Connection error when delivering integration"** — DeployHQ can't reach the Installation URL. Confirm it's reachable from outside your network and that no IP allowlist is blocking the deployment workers.
- **"Sentry token lacks `event:read` scope"** — the auth token is fine for releases but not for reading events. Re-issue the token with `project:read` and `event:read` scopes added.
- **"No new errors during the watch window" when you know there were new errors** — check that the event's `environment` tag matches the integration's environment value exactly. If you ticked Match by release, also confirm your SDK is sending the deployed commit SHA as the release.
