Repository navigation
feat(attachments): report attachments that could not be served to Sentry - #89
Draft
gmaclennan wants to merge 2 commits into
Draft
gmaclennan wants to merge 2 commits into
gmaclennan wants to merge 2 commits into
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This was referenced Nov 5, 2026
gmaclennan
commented
Nov 5, 2026
gmaclennan
left a comment
Member
Author
There was a problem hiding this comment.
Since this is always detected by Guardian Connector when trying to import from the server, maybe that is enough, rather than dealing with setting up Sentry for every server deployed.
Contributor
|
Akin to #88 (comment), I am also thinking of non Guardian Connector use cases. I remember seeing @luandro's spreadsheet of comapeo-cloud servers, and seeing a number of non-GC deployments. So this could be useful for those servers. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Today the only sign that an attachment is partly synced to the cloud is a partner's connector failing downstream: the server logs to stdout and nothing else, so a 404, a 500 with
UNKNOWN_ERRORor a 502 from the attachments route goes unnoticed until someone complains.This adds optional Sentry reporting, on only when
SENTRY_DSNis set (@sentry/nodeis imported on demand, so a deployment without a DSN does not pay for it). The attachments route insrc/routes.jsnow sends oneattachment.nonokevent for every response it could not serve as a 200, tagged with the project, the first seven characters of the drive id, type, variant, the HTTP status, a coarse class (missingfor an upstream 404,incompletewhen core resets or truncates,errorotherwise) and core's own error code where it sent one; the fetch cause (UND_ERR_SOCKETand the like) goes in the event detail and the pino warn line. The capture function is injected through the server options, so tests run without a DSN. Sentry's unhandled-rejection integration is set to strict so a DSN does not stop the process crashing the way it does today, and the client is flushed on shutdown.Scope and limits. Sentry is initialised after fastify and core are imported and its ESM loader hook is turned off, so there is no tracing or auto-instrumentation: only crashes, unhandled rejections and the attachment event above are reported, and a 5xx that fastify turns into a response on another route is not. The dependency is
@sentry/node10.x rather than 11.x because 11 requires node 20.19 and the Dockerfile pins 20.17.0. Nothing audits attachments on its own yet.Related changes. This replaces the Sentry reporting part of #79, which is being split up after review. It stacks on the audit endpoint PR (#88), because the route classifies failures with the
upstreamFailureandfetchFailurehelpers fromsrc/attachments-audit.js. After digidem/comapeo-core#1350, a partial blob reaches this route as an upstream 404 with codeBLOB_NOT_AVAILABLE_ERRORrather than a reset or truncation; the event already carries core's error code. #90 (draft) on top of this one runs the audit after each sync and reports missing attachments.