Skip to content

chore: cleanup abandoned UPLOADING MediaAssets (orphaned presigns) #68

Description

@teetangh

From CodeRabbit review on PR #67.

Problem: every requestSubmissionUpload/requestResourceUpload presign creates a MediaAsset row with status UPLOADING. If the browser PUT or finalize fails — or the learner closes the tab — the row stays UPLOADING forever with no storage object behind it.

Proposed fix: scheduled job (fits the existing Netlify scheduled-maintenance cron pattern in netlify/functions/scheduled-maintenance.mjs):

  1. Find MediaAssets with status UPLOADING older than ~24h.
  2. Delete any orphaned storage object if one exists (bucket+path).
  3. Mark rows FAILED/DELETED (MediaStatus enum already has FAILED).

Note: finalize now verifies object existence before READY (PR #67), so these rows are unreachable by submit/attach flows — this is hygiene, not a security gap.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions