fix(workspaces): surface real reason when file upload fails#604
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix(workspaces): surface real reason when file upload fails#604posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
The AsyncQueuer that drives workspace file uploads runs with throwOnError: false, so per-job failures were swallowed and onSettled threw a context-free "Failed to upload <name>." That generic message is what reached error tracking, discarding the real server reason (e.g. a 422 CONVERSION_FAILED from the office->PDF path). Capture per-job errors via the queuer's onError callback and fold the real reason(s) into the thrown error, attaching the underlying failure as `error.cause` so error tracking keeps the server context. Generated-By: PostHog Code Task-Id: 1efb7646-83c0-4822-9cee-64d6bcbb4d16
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.
What
When a workspace file upload fails, the client now surfaces the real server reason instead of a context-free message.
The upload queue (
AsyncQueuerinworkspace-file-upload.ts) runs withthrowOnError: false, so each per-job failure was swallowed. When every job failed,onSettledthrew a genericFailed to upload <name>.— and that empty message is what landed in error tracking, discarding the actual cause (for Office files, a422 CONVERSION_FAILEDfrom the LibreOffice/Gotenbergoffice_to_pdfpath).The fix captures per-job errors via the queuer's
onErrorcallback and folds the deduped reason(s) into the thrown error, attaching the underlying failure aserror.causeso error tracking keeps the server context.Why
An Office (
.pptx) upload was failing repeatedly, but error tracking only ever sawFailed to upload <name>.with no reason — so we couldn't tell whether the conversion container timed out, LibreOffice choked on the deck, or the PDF came back empty. This restores that visibility.Note: this addresses the reported symptom (the client throwing away the real reason). The specific root cause of that one
.pptxconversion can't be determined retroactively — the reason was discarded before this fix — but future occurrences will now carry the real message (LibreOffice error / empty-PDF / 60s port-ready timeout) through to error tracking.Test plan
workspace-file-upload.test.tscovering a single Office conversion failure: asserts the thrown error includes the server reason and carries the underlying failure aserror.cause.pnpm check(format + lint + types) andpnpm testpass.Created with PostHog Code from an inbox report.
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.