Skip to content

OUT-3598: surface Dropbox 409 reasons in Sentry titles#102

Merged
SandipBajracharya merged 2 commits into
mainfrom
OUT-3598
May 12, 2026
Merged

OUT-3598: surface Dropbox 409 reasons in Sentry titles#102
SandipBajracharya merged 2 commits into
mainfrom
OUT-3598

Conversation

@SandipBajracharya
Copy link
Copy Markdown
Collaborator

Summary

  • Closes the last-mile gap on DROPBOX-INTEGRATION-17: DropboxClient.buildDropboxResponseError now embeds Dropbox's error_summary into the constructed DropboxResponseError's runtime .message, so Sentry titles read e.g. Response failed with a 409 code: path/not_found/.. instead of opaque Response failed with a 409 code.
  • Trigger.dev retry behavior is intentionally unchanged — per the ticket, we want to see real error_summary data from the next occurrence before deciding on any per-reason handling.

Why

Earlier OUT-3598 commits (0426a12, dcce588) already parse Dropbox's response body and put the error_summary on the error payload — but Sentry uses Error.message for issue titles, so the parsed reason was invisible there. This final commit mutates .message post-construction so the reason rides through to Sentry's title.

Test plan

  • After deploy, wait for the next DROPBOX-INTEGRATION-17 event in Sentry and confirm the title now contains the Dropbox reason (e.g. path/not_found/..).
  • If the title is still opaque, the failure path is going through an SDK call rather than the manual-fetch content endpoint — file a separate ticket for that instrumentation gap.

Out of scope (tracked separately)

  • src/utils/withErrorHandler.ts:51-54 has a mirror branch-ordering bug (instanceof Error shadows instanceof DropboxResponseError) that affects API route responses — not the Sentry path. To be addressed in its own ticket.
  • Per-reason handling (skip on path/not_found, mark-failed on restricted_content, etc.) — explicitly deferred until real data lands.

Linear: https://linear.app/assemblycom/issue/OUT-3598/dropboxresponseerror-response-failed-with-a-409-code

🤖 Generated with Claude Code

Sentry uses Error.message for issue titles, so the error_summary we
already pull from the content-endpoint response body was invisible
there — every 409/4xx in DROPBOX-INTEGRATION-17 surfaced as opaque
"Response failed with a 4xx code".

Append the parsed error_summary to the constructed DropboxResponseError's
.message so Sentry titles read e.g.
"Response failed with a 409 code: path/not_found/..".
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 11, 2026

OUT-3598

@vercel
Copy link
Copy Markdown

vercel Bot commented May 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dropbox-integration Ready Ready Preview, Comment May 11, 2026 0:02am

Request Review

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 11, 2026

Greptile Summary

This PR closes the last-mile observability gap for Dropbox content-endpoint errors by embedding Dropbox's error_summary string into DropboxResponseError.message inside buildDropboxResponseError, so Sentry issue titles show the specific failure reason (e.g. path/not_found/..) rather than an opaque status-code string.

  • buildDropboxResponseError now reads error_summary from the constructed errorPayload and appends it to the error's .message via a cast to Error, leaving retry behavior and the error payload shape unchanged.
  • The fallback path (rawBody || fallbackSummary) already existed for non-JSON responses; this PR now also embeds that value into .message, which could produce very long titles if the body is an HTML error page from a proxy or gateway.

Confidence Score: 4/5

Safe to merge for the targeted 409 Sentry-title improvement; the only rough edge is in the non-JSON fallback path, which is unlikely to fire for the 409 case this PR is fixing.

The change is tightly scoped: one method, one new assignment to .message. For 409 responses Dropbox always returns JSON with error_summary, so the happy path works exactly as intended. The fallback path — which sets error_summary to the raw response body for non-JSON errors — could embed a large blob into the Sentry title, but this scenario (proxy/gateway HTML errors) is uncommon in the Dropbox content-endpoint context and doesn't cause data loss or incorrect retry behavior.

src/lib/dropbox/DropboxClient.ts — specifically the fallback branch in buildDropboxResponseError where rawBody becomes the embedded summary for non-JSON error responses.

Important Files Changed

Filename Overview
src/lib/dropbox/DropboxClient.ts Adds error_summary embedding into DropboxResponseError.message in buildDropboxResponseError; the fallback path can embed an unbounded raw response body into the message when the Dropbox API returns a non-JSON error.

Sequence Diagram

sequenceDiagram
    participant Caller as _downloadFile / _uploadFile
    participant BDRB as buildDropboxResponseError
    participant DBX as Dropbox API
    participant Sentry

    Caller->>DBX: manualFetch(url, headers)
    DBX-->>Caller: response (non-200)
    Caller->>BDRB: buildDropboxResponseError(response, fallbackSummary)
    BDRB->>DBX: response.text()
    DBX-->>BDRB: rawBody
    Note over BDRB: Parse JSON → errorPayload
    BDRB->>BDRB: new DropboxResponseError(status, headers, errorPayload)
    BDRB->>BDRB: Extract error_summary string
    BDRB->>BDRB: "(err as Error).message = message + summary"
    BDRB-->>Caller: DropboxResponseError (enriched .message)
    Caller-->>Sentry: "throw err → Sentry title = err.message"
Loading

Reviews (1): Last reviewed commit: "fix(OUT-3598): embed Dropbox error_summa..." | Re-trigger Greptile

Comment thread src/lib/dropbox/DropboxClient.ts Outdated
When the Dropbox content endpoint returns a non-JSON response body
(e.g. a 5xx HTML page from an upstream proxy/gateway), the fallback
path puts the entire raw body into error_summary — which previously
ended up verbatim in Error.message and the Sentry title.

Slice at 200 chars when embedding into .message; full body remains
available on err.error.error_summary for structured logs.
@SandipBajracharya SandipBajracharya merged commit e431b3b into main May 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants