Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .server-changes/attio-sync-transient-retry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
area: webapp
type: improvement
---

Transient internal sync failures are now retried quietly instead of surfacing as errors.
19 changes: 12 additions & 7 deletions apps/webapp/app/services/attio.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,18 @@ class AttioClient {

if (!response.ok) {
const body = await response.text();
logger.error("Attio assert failed", {
object,
matchingAttribute,
status: response.status,
body,
});
throw new Error(`Attio assert ${object} failed with status ${response.status}`);
// 5xx/429 are transient (the worker retries); warn + tag so they don't page Sentry. Real 4xx stay error.
const transient = response.status >= 500 || response.status === 429;
const fields = { object, matchingAttribute, status: response.status, body };
if (transient) {
logger.warn("Attio assert failed", fields);
Comment thread
isshaddad marked this conversation as resolved.
} else {
logger.error("Attio assert failed", fields);
}
const message = `Attio assert ${object} failed with status ${response.status}`;
throw transient
? Object.assign(new Error(message), { logLevel: "warn" as const })
: new Error(message);
}

const recordId = ((await response.json()) as any).data?.id?.record_id;
Expand Down