mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-06 15:22:12 +03:00
fix(sse): make safeLogEvents async — 'await' in a sync function broke every chatHelpers import
#3692 added a lazy 'await import(proxyEgress)' for egress-IP visibility inside safeLogEvents, which is a sync function — an ES syntax error. It went unnoticed because typecheck:core does not cover src/sse and no test in the merge gates loaded chatHelpers via tsx; any consumer that did (chat-context-relay and chat-route-coverage suites, integration harnesses) failed at module load with 'await can only be used inside an async function'. safeLogEvents is fire-and-forget logging with an outer try/catch, so making it async (and 'void'-ing the single chat.ts call site) preserves behavior exactly. Validation: tests/unit/chat-context-relay.test.ts + chat-route-coverage.test.ts went from failing-at-load to green (+14 tests destravados).
This commit is contained in:
@@ -1058,8 +1058,8 @@ async function handleSingleModelChat(
|
||||
getTargetFormat(provider, credentials.providerSpecificData) ||
|
||||
targetFormat;
|
||||
|
||||
// 5. Log proxy + translation events
|
||||
safeLogEvents({
|
||||
// 5. Log proxy + translation events (fire-and-forget; never blocks the response)
|
||||
void safeLogEvents({
|
||||
result,
|
||||
proxyInfo,
|
||||
proxyLatency,
|
||||
|
||||
@@ -592,7 +592,9 @@ export async function safeResolveProxy(connectionId: string, apiKeyId?: string)
|
||||
}
|
||||
}
|
||||
|
||||
export function safeLogEvents({
|
||||
// Async because the egress-IP lookup lazy-imports proxyEgress; callers treat
|
||||
// this as fire-and-forget logging (the internal try/catch swallows everything).
|
||||
export async function safeLogEvents({
|
||||
result,
|
||||
proxyInfo,
|
||||
proxyLatency,
|
||||
|
||||
Reference in New Issue
Block a user