@sentry/junior-sentry 0.263.0 → 0.265.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{chunk-KUDJGV46.js → chunk-KK3VWIJ2.js} +5 -16
- package/dist/events/metric-alert.d.ts +1 -1
- package/dist/index.js +2 -5
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -3
- package/dist/webhooks/events.d.ts +0 -1
- package/dist/webhooks/handler.d.ts +0 -1
- package/dist/webhooks/secret.d.ts +0 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -43,11 +43,11 @@ Use a **Sentry internal integration** (not a public app install flow):
|
|
|
43
43
|
|
|
44
44
|
1. Subscribe to the **issue** webhook resource.
|
|
45
45
|
2. Point it at `https://<junior-host>/api/webhooks/sentry`.
|
|
46
|
-
3. Set the
|
|
46
|
+
3. Set the integration client secret as `SENTRY_WEBHOOK_SECRET`, then redeploy.
|
|
47
47
|
|
|
48
48
|
For metric alerts, also enable **Alert Rule Action** on the integration and add it as a `sentry_app` trigger action on each alert. Sentry sends metric alerts only to alert actions.
|
|
49
49
|
|
|
50
|
-
Junior verifies `Sentry-Hook-Signature`,
|
|
50
|
+
Junior verifies `Sentry-Hook-Signature`, reads the org slug from the signed payload, and publishes:
|
|
51
51
|
|
|
52
52
|
- `issue.created` for `org/project#issueId` and `org/project`.
|
|
53
53
|
- `metric_alert.critical`, `metric_alert.warning`, and `metric_alert.resolved` for `metric-alert:org/alertRuleId` and for `org/project` of each project on the alert rule.
|
|
@@ -27,7 +27,7 @@ var SENTRY_METRIC_ALERT_SUGGESTED_EVENTS = [
|
|
|
27
27
|
];
|
|
28
28
|
var SENTRY_METRIC_ALERT_IDENTIFIER = {
|
|
29
29
|
format: "metric-alert:org/alertRuleId",
|
|
30
|
-
pattern:
|
|
30
|
+
pattern: String.raw`^metric-alert:[^\s/:#]+\/\d+$`
|
|
31
31
|
};
|
|
32
32
|
function sentryMetricAlertResource(input) {
|
|
33
33
|
return {
|
|
@@ -119,7 +119,7 @@ function normalizeIssueEvents(input) {
|
|
|
119
119
|
if (!parsed.success || parsed.data.action !== "created") return [];
|
|
120
120
|
const issue = parsed.data.data.issue;
|
|
121
121
|
const org = organizationSlug(issue.url)?.toLowerCase();
|
|
122
|
-
if (!org
|
|
122
|
+
if (!org) return [];
|
|
123
123
|
const issueResource = sentryIssueResource({
|
|
124
124
|
issueId: issue.id,
|
|
125
125
|
org,
|
|
@@ -155,7 +155,7 @@ function normalizeMetricAlertEvents(input) {
|
|
|
155
155
|
}
|
|
156
156
|
const { data } = parsed.data;
|
|
157
157
|
const org = webOrganizationSlug(data.web_url)?.toLowerCase();
|
|
158
|
-
if (!org
|
|
158
|
+
if (!org) return [];
|
|
159
159
|
const alertRuleId = data.metric_alert.alert_rule.id;
|
|
160
160
|
const incidentId = data.metric_alert.id;
|
|
161
161
|
const resource = sentryMetricAlertResource({ alertRuleId, org });
|
|
@@ -231,17 +231,10 @@ function createSentryWebhookRoute(args) {
|
|
|
231
231
|
status: 400
|
|
232
232
|
});
|
|
233
233
|
}
|
|
234
|
-
const webhookOrg = args.webhookOrg();
|
|
235
|
-
if (!webhookOrg) {
|
|
236
|
-
return new Response("Sentry webhook organization is not configured", {
|
|
237
|
-
status: 503
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
234
|
const events = normalizeSentryEvents({
|
|
241
235
|
body,
|
|
242
236
|
hookResource,
|
|
243
|
-
hookTimestamp: request.headers.get("sentry-hook-timestamp")?.trim() || void 0
|
|
244
|
-
webhookOrg
|
|
237
|
+
hookTimestamp: request.headers.get("sentry-hook-timestamp")?.trim() || void 0
|
|
245
238
|
});
|
|
246
239
|
for (const event of events) {
|
|
247
240
|
await args.events.publish(event);
|
|
@@ -257,9 +250,6 @@ function createSentryWebhookRoute(args) {
|
|
|
257
250
|
function sentryWebhookSecret() {
|
|
258
251
|
return process.env.SENTRY_WEBHOOK_SECRET?.trim() || void 0;
|
|
259
252
|
}
|
|
260
|
-
function sentryWebhookOrg() {
|
|
261
|
-
return process.env.SENTRY_WEBHOOK_ORG?.trim().toLowerCase() || void 0;
|
|
262
|
-
}
|
|
263
253
|
|
|
264
254
|
export {
|
|
265
255
|
SENTRY_ISSUE_EVENTS,
|
|
@@ -270,6 +260,5 @@ export {
|
|
|
270
260
|
SENTRY_METRIC_ALERT_IDENTIFIER,
|
|
271
261
|
normalizeSentryEvents,
|
|
272
262
|
createSentryWebhookRoute,
|
|
273
|
-
sentryWebhookSecret
|
|
274
|
-
sentryWebhookOrg
|
|
263
|
+
sentryWebhookSecret
|
|
275
264
|
};
|
|
@@ -5,7 +5,7 @@ export declare const SENTRY_METRIC_ALERT_SUGGESTED_EVENTS: string[];
|
|
|
5
5
|
/** The identifier shape that `sentryMetricAlertResource` builds. */
|
|
6
6
|
export declare const SENTRY_METRIC_ALERT_IDENTIFIER: {
|
|
7
7
|
format: string;
|
|
8
|
-
pattern:
|
|
8
|
+
pattern: string;
|
|
9
9
|
};
|
|
10
10
|
/** Build the stable Sentry metric alert identity shared by tools and webhooks. */
|
|
11
11
|
export declare function sentryMetricAlertResource(input: {
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,8 @@ import {
|
|
|
4
4
|
SENTRY_METRIC_ALERT_IDENTIFIER,
|
|
5
5
|
SENTRY_METRIC_ALERT_SUGGESTED_EVENTS,
|
|
6
6
|
createSentryWebhookRoute,
|
|
7
|
-
sentryWebhookOrg,
|
|
8
7
|
sentryWebhookSecret
|
|
9
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KK3VWIJ2.js";
|
|
10
9
|
|
|
11
10
|
// src/index.ts
|
|
12
11
|
import {
|
|
@@ -122,7 +121,7 @@ function sentryPlugin() {
|
|
|
122
121
|
suggestedEvents: SENTRY_METRIC_ALERT_SUGGESTED_EVENTS
|
|
123
122
|
}
|
|
124
123
|
],
|
|
125
|
-
isEnabled: () => Boolean(sentryWebhookSecret())
|
|
124
|
+
isEnabled: () => Boolean(sentryWebhookSecret()),
|
|
126
125
|
normalizeIdentifier: (identifier) => identifier.toLowerCase()
|
|
127
126
|
},
|
|
128
127
|
manifest: {
|
|
@@ -142,7 +141,6 @@ function sentryPlugin() {
|
|
|
142
141
|
SENTRY_CLIENT_ID: {},
|
|
143
142
|
SENTRY_CLIENT_SECRET: {},
|
|
144
143
|
SENTRY_READ_TOKEN: {},
|
|
145
|
-
SENTRY_WEBHOOK_ORG: {},
|
|
146
144
|
SENTRY_WEBHOOK_SECRET: {}
|
|
147
145
|
},
|
|
148
146
|
name: "sentry",
|
|
@@ -169,7 +167,6 @@ function sentryPlugin() {
|
|
|
169
167
|
return [
|
|
170
168
|
createSentryWebhookRoute({
|
|
171
169
|
events: ctx.events,
|
|
172
|
-
webhookOrg: sentryWebhookOrg,
|
|
173
170
|
webhookSecret: sentryWebhookSecret
|
|
174
171
|
})
|
|
175
172
|
];
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { sentryIssueResource, sentryProjectResource } from "./events/issue.js";
|
|
2
2
|
export { createSentryWebhookRoute } from "./webhooks/handler.js";
|
|
3
3
|
export { normalizeSentryEvents } from "./webhooks/events.js";
|
|
4
|
-
export {
|
|
4
|
+
export { sentryWebhookSecret } from "./webhooks/secret.js";
|
package/dist/testing.js
CHANGED
|
@@ -3,14 +3,12 @@ import {
|
|
|
3
3
|
normalizeSentryEvents,
|
|
4
4
|
sentryIssueResource,
|
|
5
5
|
sentryProjectResource,
|
|
6
|
-
sentryWebhookOrg,
|
|
7
6
|
sentryWebhookSecret
|
|
8
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KK3VWIJ2.js";
|
|
9
8
|
export {
|
|
10
9
|
createSentryWebhookRoute,
|
|
11
10
|
normalizeSentryEvents,
|
|
12
11
|
sentryIssueResource,
|
|
13
12
|
sentryProjectResource,
|
|
14
|
-
sentryWebhookOrg,
|
|
15
13
|
sentryWebhookSecret
|
|
16
14
|
};
|
|
@@ -3,7 +3,6 @@ interface WebhookInput {
|
|
|
3
3
|
body: unknown;
|
|
4
4
|
hookResource: string;
|
|
5
5
|
hookTimestamp?: string;
|
|
6
|
-
webhookOrg: string;
|
|
7
6
|
}
|
|
8
7
|
/** Normalize one verified Sentry webhook into subscribable Sentry events. */
|
|
9
8
|
export declare function normalizeSentryEvents(input: WebhookInput): EventInput[];
|
|
@@ -2,6 +2,5 @@ import type { PluginRoute, EventPublisher } from "@sentry/junior-plugin-api";
|
|
|
2
2
|
/** Create the public, signed Sentry event webhook route. */
|
|
3
3
|
export declare function createSentryWebhookRoute(args: {
|
|
4
4
|
events: EventPublisher;
|
|
5
|
-
webhookOrg(): string | undefined;
|
|
6
5
|
webhookSecret(): string | undefined;
|
|
7
6
|
}): PluginRoute;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
/** Read the internal-integration client secret used for issue webhook ingress. */
|
|
2
2
|
export declare function sentryWebhookSecret(): string | undefined;
|
|
3
|
-
/** Read the Sentry organization allowed to publish issue webhooks. */
|
|
4
|
-
export declare function sentryWebhookOrg(): string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-sentry",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.265.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"zod": "^4.5.4",
|
|
30
|
-
"@sentry/junior-plugin-api": "0.
|
|
30
|
+
"@sentry/junior-plugin-api": "0.265.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@oxlint/plugins": "1.79.0",
|