Skip to content

Commit e16c6e7

Browse files
committed
more api logging
1 parent eb62eb8 commit e16c6e7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

apps/api/src/stt/connection.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ export class WsProxyConnection {
105105
return;
106106
}
107107

108+
console.log("[ws-proxy] connecting to upstream:", this.upstreamUrl);
109+
108110
const wsOptions: WebSocketOptions =
109111
this.headers && Object.keys(this.headers).length > 0
110112
? { headers: this.headers }
@@ -282,6 +284,12 @@ export class WsProxyConnection {
282284
});
283285

284286
this.upstream.addEventListener("close", (event) => {
287+
console.log("[ws-proxy] upstream closed:", {
288+
url: this.upstreamUrl,
289+
code: event.code,
290+
reason: event.reason,
291+
wasReady: this.upstreamReady,
292+
});
285293
this.clearErrorTimeout();
286294
if (!this.upstreamReady) {
287295
this.rejectUpstreamReadyWaiters(
@@ -298,10 +306,17 @@ export class WsProxyConnection {
298306
});
299307

300308
this.upstream.addEventListener("error", (error) => {
309+
console.error("[ws-proxy] upstream error:", {
310+
url: this.upstreamUrl,
311+
errorType: error?.constructor?.name,
312+
message: error instanceof Error ? error.message : String(error),
313+
readyState: this.upstream?.readyState,
314+
});
301315
Sentry.captureException(
302316
error instanceof Error ? error : new Error("upstream_websocket_error"),
303317
{
304318
tags: { operation: "upstream_error" },
319+
extra: { upstreamUrl: this.upstreamUrl },
305320
},
306321
);
307322
if (!this.upstreamReady) {

0 commit comments

Comments
 (0)