Skip to content

Add structured logging to uploadBlob handler for error diagnosis - #18

Merged
aspiers merged 4 commits into
devfrom
copilot/add-logging-statements-handler
Jan 25, 2026
Merged

aspiers merged 4 commits into
devfrom
copilot/add-logging-statements-handler

Conversation

Copilot AI commented Jan 25, 2026 •

Copy link
Copy Markdown

Summary

Successfully added comprehensive logging to the uploadBlob handler to help identify the source of 4xx and 5xx errors.

Completed Tasks

  • Add logging at handler entry with input details
  • Add logging for repo parameter parsing and validation
  • Add logging for shared repository access checks
  • Add logging for account validation calls
  • Add logging for OAuth permission checks
  • Add logging before blob upload operation
  • Add logging after blob upload succeeds
  • Add logging for transaction operations (trackUntetheredBlob, verifyBlobAndMakePermanent)
  • Add error logging in catch blocks with context
  • Add logging at handler exit with response
  • Apply consistent [uploadBlob] prefix to all log statements
  • Code review completed and feedback addressed
  • Security scan completed (no issues found)
  • Run prettier formatting

Changes

  • File: packages/sds/src/api/com/sds/repo/uploadBlob.ts
  • Lines Added: ~105 lines of logging
  • Business Logic Changed: None
  • Pattern: Consistent [uploadBlob] prefix for all logs
  • Error Handling: All catch blocks now include detailed error logging

Benefits

  • Easy identification of error sources through step-by-step logging
  • Consistent log format for filtering in log aggregation systems
  • Detailed context in all error messages
  • Non-invasive changes that maintain backward compatibility
Original prompt

Add simple logging statements to the handler in packages/sds/src/api/com/sds/repo/uploadBlob.ts to help identify the source of 4xx or 5xx errors. The logging statements should clearly log each step of the process, especially around any external calls, validation, and exception handling. Focus on logging when entering and exiting main functions or handlers, as well as when errors occur.

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


Note

Introduces comprehensive logging to improve diagnosability of blob uploads, covering repository resolution, permission checks, and blob lifecycle.

  • Instrument uploadBlob with entry/exit logs and context (user DID, repo DID, MIME, CID/size)
  • Add logs around shared repo permission checks, OAuth scope assertions, and account lookups
  • Log upload start/completion, timeout detection, and transaction steps (track untethered, record lookup, permanence)
  • Wrap critical sections in try/catch to log and rethrow errors; no business logic changes
  • Standardize messages with [uploadBlob] prefix for filtering

Written by Cursor Bugbot for commit 32b8c91. This will update automatically on new commits. Configure here.

@vercel

vercel Bot commented Jan 25, 2026 •

Copy link
Copy Markdown

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

Project Deployment Review Updated (UTC)
sds-demo Ready Ready Preview, Comment Jan 25, 2026 8:16pm

Request Review

Co-authored-by: aspiers <100738+aspiers@users.noreply.github.com>
Co-authored-by: aspiers <100738+aspiers@users.noreply.github.com>
Copilot AI changed the title [WIP] Add logging statements to uploadBlob handler Add structured logging to uploadBlob handler for error diagnosis Jan 25, 2026
Copilot AI requested a review from aspiers January 25, 2026 19:16
@aspiers
aspiers marked this pull request as ready for review January 25, 2026 20:01
Copilot AI review requested due to automatic review settings January 25, 2026 20:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive structured logging to the uploadBlob handler to improve error diagnosis in production. The handler lacked visibility into failure points, making 4xx/5xx errors difficult to debug.

Changes:

  • Added step-by-step logging with [uploadBlob] prefix throughout the handler execution path
  • Added logging for entry/exit points, permission checks, account operations, blob operations, transaction flow, and error contexts
  • All error catch blocks now log relevant context before re-throwing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aspiers

aspiers commented Jan 25, 2026

Copy link
Copy Markdown
Collaborator

@copilot You didn't run prettier!

Co-authored-by: aspiers <100738+aspiers@users.noreply.github.com>

Copilot AI commented Jan 25, 2026 •

Copy link
Copy Markdown
Author

@copilot You didn't run prettier!

Fixed in commit 0c92ca8. Prettier formatting has been applied to the file.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • googlechromelabs.github.io
    • Triggering command: /usr/local/bin/node node install.mjs (dns block)
  • https://storage.googleapis.com/chrome-for-testing-public/129.0.6668.100/linux64/chrome-headless-shell-linux64.zip
    • Triggering command: /usr/local/bin/node node install.mjs (http block)
  • https://storage.googleapis.com/chrome-for-testing-public/129.0.6668.100/linux64/chrome-linux64.zip
    • Triggering command: /usr/local/bin/node node install.mjs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from aspiers January 25, 2026 20:14
@aspiers
aspiers merged commit 9afd623 into dev Jan 25, 2026
12 checks passed
@aspiers
aspiers deleted the copilot/add-logging-statements-handler branch January 26, 2026 06:25

This branch was successfully deployed

1 active deployment
Preview — 0c92ca8b Deployed Jan 25, 2026 by vercel[bot]
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.

3 participants