aegis-bridge 2.3.1 → 2.3.2
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/dist/channels/webhook.js +8 -2
- package/package.json +1 -1
package/dist/channels/webhook.js
CHANGED
|
@@ -86,7 +86,12 @@ export class WebhookChannel {
|
|
|
86
86
|
return;
|
|
87
87
|
await this.deliverWithRetry(ep, body, payload.event);
|
|
88
88
|
});
|
|
89
|
-
await Promise.allSettled(promises);
|
|
89
|
+
const results = await Promise.allSettled(promises);
|
|
90
|
+
const failed = results.filter((r) => r.status === 'rejected');
|
|
91
|
+
if (failed.length > 0) {
|
|
92
|
+
const reasons = failed.map(r => String(r.reason)).join('; ');
|
|
93
|
+
console.error(`Webhook: ${failed.length}/${promises.length} endpoint(s) failed: ${reasons}`);
|
|
94
|
+
}
|
|
90
95
|
}
|
|
91
96
|
/** Issue #25: Deliver webhook with retry + exponential backoff. */
|
|
92
97
|
async deliverWithRetry(ep, body, event, maxRetries = WebhookChannel.MAX_RETRIES) {
|
|
@@ -117,7 +122,6 @@ export class WebhookChannel {
|
|
|
117
122
|
if (res.status >= 500) {
|
|
118
123
|
this.addToDeadLetterQueue(ep.url, event, lastError, attempt);
|
|
119
124
|
}
|
|
120
|
-
return;
|
|
121
125
|
}
|
|
122
126
|
catch (e) {
|
|
123
127
|
lastError = getErrorMessage(e);
|
|
@@ -130,6 +134,8 @@ export class WebhookChannel {
|
|
|
130
134
|
console.error(`Webhook ${ep.url} failed after ${maxRetries} attempts for ${event}: ${lastError}`);
|
|
131
135
|
this.addToDeadLetterQueue(ep.url, event, lastError, maxRetries);
|
|
132
136
|
}
|
|
137
|
+
// Final failure (HTTP or network) — throw so fire() can aggregate
|
|
138
|
+
throw new Error(lastError);
|
|
133
139
|
}
|
|
134
140
|
}
|
|
135
141
|
/** Issue #89 L14: Add a failed delivery to the dead letter queue. */
|