fix: use raw AUD0 client in outbox dispatcher

This commit is contained in:
2026-09-07 17:55:10 +02:00
parent f0958cf708
commit 4c7132728a
@@ -44,7 +44,11 @@ export async function POST(request: NextRequest) {
}
const repo = repository();
const dispatcher = new Aud0OutboxDispatcher(repo, createAud0Client());
// CRITICAL: the dispatcher must bypass the durable wrapper. Using the
// default client here would enqueue the event again and could create an
// infinite outbox loop instead of delivering to AUD0.
const rawAud0 = createAud0Client(undefined, { durable: false });
const dispatcher = new Aud0OutboxDispatcher(repo, rawAud0);
const result = await dispatcher.sweep(limit);
const stats = await repo.stats();
return NextResponse.json({ result, stats });