Openstatus www.openstatus.dev

๐Ÿ› notification not triggered (#437)

authored by

Thibault Le Ouay and committed by
GitHub
69116196 23b17a78

+45 -4
+2 -1
apps/server/src/checker/checker.ts
··· 1 - import { updateMonitorStatus } from "./alerting"; 1 + import { triggerAlerting, updateMonitorStatus } from "./alerting"; 2 2 import type { PublishPingType } from "./ping"; 3 3 import { pingEndpoint, publishPing } from "./ping"; 4 4 import type { Payload } from "./schema"; ··· 78 78 monitorId: data.monitorId, 79 79 status: "error", 80 80 }); 81 + await triggerAlerting({ monitorId: data.monitorId }); 81 82 } 82 83 } 83 84 }
-1
apps/server/src/checker/index.ts
··· 15 15 16 16 checkerRoute.post("/checker", async (c) => { 17 17 const json = await c.req.json(); 18 - 19 18 const auth = c.req.header("Authorization"); 20 19 if (auth !== `Basic ${env.CRON_SECRET}`) { 21 20 console.error("Unauthorized");
+1 -1
apps/server/src/utils/random-promise.ts
··· 2 2 return new Promise((resolve, reject) => { 3 3 const randomTime = Math.floor(Math.random() * 1000); 4 4 setTimeout(() => { 5 - const shouldResolve = Math.random() < 0; // 0.5 5 + const shouldResolve = Math.random() < 1; // 0.5 6 6 if (shouldResolve) { 7 7 resolve("Promise resolved successfully."); 8 8 } else {
+1 -1
apps/server/src/v1/incidentUpdate.ts
··· 18 18 .min(1) 19 19 .openapi({ 20 20 param: { 21 - name: "incidentId", 21 + name: "id", 22 22 in: "path", 23 23 }, 24 24 description: "The id of the update",
+41
utils/api-bruno/checker.bru
··· 1 + meta { 2 + name: checker 3 + type: http 4 + seq: 2 5 + } 6 + 7 + post { 8 + url: {{url}}/checker 9 + body: text 10 + auth: none 11 + } 12 + 13 + headers { 14 + Authorization: Basic test 15 + X-CloudTasks-TaskRetryCount: 1 16 + Content-Type: application/json 17 + } 18 + 19 + body:json { 20 + { 21 + "workspaceId": 1, 22 + "monitorId": 1, 23 + "method": "GET", 24 + "url":"https://openstat.us/404", 25 + "status": "active", 26 + "cronTimestamp":1699088595307 27 + "pageIds":["1"] 28 + } 29 + } 30 + 31 + body:text { 32 + { 33 + "workspaceId": "1", 34 + "monitorId": "1", 35 + "method": "GET", 36 + "url":"https://openstat.us/404", 37 + "status": "active", 38 + "cronTimestamp":1699088595307, 39 + "pageIds":["1"] 40 + } 41 + }