Skip to content

fix(account-deletion): list storage keys through the S3 client so Trigger runs can sweep - #9193

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/storage-sweep-s3-list-static-import
Oct 18, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/storage-sweep-s3-list-static-import

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Since v0.9.26 reached production, every account-deletion.storage.workspace-sweep and project-file.storage.prefix-cleanup outbox event fails in Trigger.dev with ListObjectsV2Command is not a constructor and dead-letters after 10 attempts. No objects are deleted, so nothing live is at risk, but a deleted account's storage and a deleted Project's files are left behind.
  • Cause: listStorageKeyPage loaded the command with await import('@aws-sdk/client-s3'). The Trigger bundle resolves that package to its CommonJS build, and the dynamically imported namespace does not carry ListObjectsV2Command; static named imports of the same package (the rest of providers/s3/client.ts) are unaffected. Next.js resolves the package differently, so the app and the unit tests never hit it.
  • Fix: the listing moves into listS3ObjectKeyPage in lib/uploads/providers/s3/client.ts, beside the other S3 commands it imports statically, and listStorageKeyPage calls it the way the Blob and GCS branches call their client modules. It now also fails clearly when the bucket is unset rather than sending Bucket: undefined.

Verification

I bundled the real listStorageKeyPage → S3 client path with esbuild (Node platform, code splitting, default main-first resolution) and pointed it at a local ListObjectsV2 mock that returns two pages:

  • origin/staging: {"status":"fail","error":"TypeError: ListObjectsV2Command is not a constructor"}. This is the exact production error.
  • this branch: {"status":"pass","pages":[{"keys":["ws/u1/a.txt","ws/u1/b.txt"],"done":false,"nextPageToken":"tok-2"},{"keys":["ws/u1/c.txt"],"done":true}]}

Follow-up after deploy

Dead-lettered events of both types need a requeue (POST /api/v1/admin/outbox/{id}/requeue). Both handlers are idempotent and re-check every reference before deleting.

🤖 Generated with Claude Code

…gger runs can sweep

The account storage sweep and Project file prefix cleanup listed S3 keys with
`await import('@aws-sdk/client-s3')`. The Trigger.dev bundle resolves that package
to its CommonJS build, and the dynamic import's namespace does not carry
`ListObjectsV2Command`, so every listing threw "ListObjectsV2Command is not a
constructor" and both outbox event types dead-lettered after 10 attempts. The
listing now lives in `listS3ObjectKeyPage` beside the other S3 commands, which
the S3 client module imports statically.
@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 18, 2026 8:54pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous bucket error is fixed.

Summary

Moves S3 key listing into listS3ObjectKeyPage, where ListObjectsV2Command is imported statically.

  • S3 cleanup sweeps can list object keys page by page.

Reviews (2) · Last reviewed commit: "fix(uploads): keep deleteS3ObjectVersion..." · Reviewed by Greptile

Comment thread apps/sim/lib/uploads/providers/s3/client.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile-apps review

@waleedlatif1
waleedlatif1 merged commit bd8dd00 into staging Oct 18, 2026
52 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/storage-sweep-s3-list-static-import branch October 18, 2026 22:12

This branch was previously deployed

1 inactive deployment
Preview — 6f410001 Deployed Oct 18, 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.

1 participant