Repository navigation
fix(account-deletion): list storage keys through the S3 client so Trigger runs can sweep - #9193
Merged
Merged
Conversation
…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.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
[Medium impact] The PR appears safe to merge; the previous bucket error is fixed. SummaryMoves S3 key listing into
Reviews (2) · Last reviewed commit: "fix(uploads): keep deleteS3ObjectVersion..." · Reviewed by Greptile |
Collaborator
Author
|
@greptile-apps review |
This branch was previously deployed
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.
Summary
account-deletion.storage.workspace-sweepandproject-file.storage.prefix-cleanupoutbox event fails in Trigger.dev withListObjectsV2Command is not a constructorand 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.listStorageKeyPageloaded the command withawait import('@aws-sdk/client-s3'). The Trigger bundle resolves that package to its CommonJS build, and the dynamically imported namespace does not carryListObjectsV2Command; static named imports of the same package (the rest ofproviders/s3/client.ts) are unaffected. Next.js resolves the package differently, so the app and the unit tests never hit it.listS3ObjectKeyPageinlib/uploads/providers/s3/client.ts, beside the other S3 commands it imports statically, andlistStorageKeyPagecalls it the way the Blob and GCS branches call their client modules. It now also fails clearly when the bucket is unset rather than sendingBucket: undefined.Verification
I bundled the real
listStorageKeyPage→ S3 client path with esbuild (Node platform, code splitting, defaultmain-first resolution) and pointed it at a local ListObjectsV2 mock that returns two pages:{"status":"fail","error":"TypeError: ListObjectsV2Command is not a constructor"}. This is the exact production error.{"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