2
0

🐛 (s3) Skip object removals when S3 not configured

Closes #1763
This commit is contained in:
Baptiste Arnaud
2024-09-04 11:54:55 +02:00
parent 5fa946c0eb
commit fa14029fed
3 changed files with 10 additions and 7 deletions

View File

@ -5,6 +5,7 @@ import {
removeAllObjectsFromResult,
removeObjectsFromResult,
} from '@typebot.io/lib/s3/removeObjectsRecursively'
import { env } from '../env/env'
type ArchiveResultsProps = {
typebot: Pick<Typebot, 'groups' | 'workspaceId' | 'id'>
@ -99,7 +100,7 @@ export const archiveResults =
},
}),
])
if (!isDeletingAllResults) {
if (!isDeletingAllResults && env.S3_BUCKET) {
await removeObjectsFromResult({
workspaceId: typebot.workspaceId,
resultIds: resultIds,
@ -108,7 +109,7 @@ export const archiveResults =
}
} while (currentTotalResults >= batchSize)
if (isDeletingAllResults) {
if (isDeletingAllResults && env.S3_BUCKET) {
await removeAllObjectsFromResult({
workspaceId: typebot.workspaceId,
typebotId: typebot.id,