Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(sync-service): export durable object fetch errors with their request (#8408)

teo1d19174e5023
diff --git a/services/sync-service/src/durable_object.rs b/services/sync-service/src/durable_object.rs
index f86b173b9b..f52f3082da 100644
--- a/services/sync-service/src/durable_object.rs
+++ b/services/sync-service/src/durable_object.rs
@@ -1063,14 +1063,21 @@ impl DurableObject for DocumentSyncSession {
trace.remote_parent = %remote_parent,
);
+ // Log the failure inside the span and the scope: the scope flushes
+ // telemetry when it ends, and a log buffered after it is only exported
+ // if a later request on the same isolate happens to flush it.
let res = worker_rs_otel::scope(
&self.env,
&self.state,
- self.inner_fetch(req).instrument(span),
+ async {
+ self.inner_fetch(req)
+ .await
+ .context("DurableObject::fetch error")
+ }
+ .instrument(span),
)
.await;
- res.context("DurableObject::fetch error")?
- .with_cors(&cors(set_allow_origin.as_deref()))
+ res?.with_cors(&cors(set_allow_origin.as_deref()))
}
async fn websocket_message(&self, ws: WebSocket, msg: WebSocketIncomingMessage) -> Result<()> {