Skip to content

feat: Add sentry to capture errors for 2wp-api development env#450

Open
annipi wants to merge 1 commit into
mainfrom
feat/sentry
Open

feat: Add sentry to capture errors for 2wp-api development env#450
annipi wants to merge 1 commit into
mainfrom
feat/sentry

Conversation

@annipi

@annipi annipi commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

SUP-260

Adding SENTRY_DSN env variable to set sentry DSN for each environment.

Project 2wp-api-dev issues
Screenshot 2026-02-04 at 4 46 35 PM

@github-actions

github-actions Bot commented Feb 4, 2026

Copy link
Copy Markdown

Dependency Review

The following issues were found:

  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ✅ 0 package(s) with unknown licenses.
  • ⚠️ 1 packages with OpenSSF Scorecard issues.

View full job summary

@annipi annipi force-pushed the feat/sentry branch 3 times, most recently from 768069c to 562a673 Compare February 6, 2026 16:39
@sonarqubecloud

sonarqubecloud Bot commented Feb 6, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
53.8% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@alexjavabraz alexjavabraz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Dominikkq Dominikkq left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move direct sentry imports out of controllers/services into a shared error-reporter wrapper so business code doesnt depend on the SDK directly and we keep one integration point for future filtering/sanitization/changes

Comment thread src/index.ts
import {ApplicationConfig, TwpapiApplication} from './application';
import {DaemonRunner} from './daemon-runner';
import { ENVIRONMENT_PRODUCTION } from './constants';
import './instrument';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this import to after config() runs

Comment thread src/instrument.ts
const Sentry = require("@sentry/node");

const dsn = process.env.SENTRY_DSN;
if (!dsn) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will crash on missing DSN

resolve(responseAddress);
})
.catch(() => {
Sentry.captureException(`Error getting address ${address}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sentry here should capture reason too, like on line 52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants