Skip to content

Commit

Permalink
fix: remove ability to delete from s3 due to permissions issue (#349)
Browse files Browse the repository at this point in the history
* fix: remove ability to delete from s3 due to permissions issue

* fix: use structured logging
  • Loading branch information
as1729 authored Jun 28, 2024
1 parent 9f1ba1f commit 5bea8be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/src/services/uploads/uploads.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ describe('uploads', () => {
await deleteUpload({
id: scenario.upload.one.id,
})
expect(deleteUploadFile).toHaveBeenCalled()
expect(deleteUploadFile).not.toHaveBeenCalled()
})

scenario(
Expand Down
6 changes: 4 additions & 2 deletions api/src/services/uploads/uploads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
} from 'types/graphql'

import { hasRole } from 'src/lib/auth'
import { s3PutSignedUrl, deleteUploadFile } from 'src/lib/aws'
import { s3PutSignedUrl } from 'src/lib/aws'
import aws from 'src/lib/aws'
import { ROLES } from 'src/lib/constants'
import { db } from 'src/lib/db'
Expand Down Expand Up @@ -95,7 +95,9 @@ export const deleteUpload: MutationResolvers['deleteUpload'] = ({ id }) => {
if (!upload) {
throw new ValidationError(`Upload with id ${id} not found`)
}
deleteUploadFile(upload)
// TODO: fix aws permissions issue on ECS instance. For now, we'll just log the delete
// deleteUploadFile(upload)
logger.info({ upload_id: id }, 'deleted database record for upload')

// 2. delete the upload
return db.upload.delete({
Expand Down

0 comments on commit 5bea8be

Please sign in to comment.