Will WebTorrent files be automatically deleted if the origianl videos were deleted?

Hi, I enabled to output WebTorrent files when the videos are uploaded.

I also use object storage to store all the video files. Upon checking the deleted videos, I noticed that the WebTorrent files are kept on the object storage.

Will them be deleted or maybe at a later time?

Considering the files size is close to 120M for that WebTorrent file( of which the original videos has already been deleted), I certainly do hope the WebTorrent file will be deleted automatically as well. :grinning:

Hi,

Deleting a video on PeerTube should also delete it on object storage. Do you have error in PeerTube logs?

Thanks for the information.

Yes. Here the error messages what I found, both the HLS video and webTorrent files as well as the folders were not deleted.

I used Yunohost to install peertube. It seems it is because the permission issue, am I right?

error[2023/11/1 14:44:53] Some errors when removing files of video 09b5d765-c05c-486f-8498-d43a78893686 in before destroy hook.

{
  "err": {
    "stack": "AccessDenied: Access Denied\n    at throwDefaultError (/var/www/peertube/node_modules/@aws-sdk/smithy-client/dist-cjs/default-error-handler.js:8:22)\n    at /var/www/peertube/node_modules/@aws-sdk/smithy-client/dist-cjs/default-error-handler.js:18:39\n    at de_DeleteObjectCommandError (/var/www/peertube/node_modules/@aws-sdk/client-s3/dist-cjs/protocols/Aws_restXml.js:3554:12)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async /var/www/peertube/node_modules/@aws-sdk/middleware-serde/dist-cjs/deserializerMiddleware.js:7:24\n    at async /var/www/peertube/node_modules/@aws-sdk/middleware-signing/dist-cjs/middleware.js:14:20\n    at async /var/www/peertube/node_modules/@aws-sdk/middleware-retry/dist-cjs/retryMiddleware.js:27:46\n    at async /var/www/peertube/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:7:26\n    at async Promise.all (index 2)\n    at async Promise.all (index 0)",
    "name": "AccessDenied",
    "$fault": "client",
    "$metadata": {
      "httpStatusCode": 403,
      "requestId": "AD1E864FA7920379:A",
      "extendedRequestId": "O41AOpQAXbdHkzNnMbpBkrnK7mMiNDvC30JQJXSocPw4aq7PdY6wZGn9DlsTcmnCemtUaGXWR6YM",
      "attempts": 1,
      "totalRetryDelay": 0
    },
    "Code": "AccessDenied",
    "RequestId": "AD1E864FA7920379:A",
    "HostId": "O41AOpQAXbdHkzNnMbpBkrnK7mMiNDvC30JQJXSocPw4aq7PdY6wZGn9DlsTcmnCemtUaGXWR6YM",
    "message": "Access Denied",
    "$response": {
      "statusCode": 403,
      "headers": {
        "content-type": "application/xml",
        "date": "Wed, 01 Nov 2023 18:44:53 GMT",
        "server": "WasabiS3/7.16.1950-2023-08-24-c6d9c0fd32 (head5)",
        "x-amz-id-2": "O41AOpQAXbdHkzNnMbpBkrnK7mMiNDvC30JQJXSocPw4aq7PdY6wZGn9DlsTcmnCemtUaGXWR6YM",
        "x-amz-request-id": "AD1E864FA7920379:A",
        "transfer-encoding": "chunked"
      },
      "body": {
        "_readableState": {
          "objectMode": false,
          "highWaterMark": 16384,
          "buffer": {
            "head": null,
            "tail": null,
            "length": 0
          },
          "length": 0,
          "pipes": [],
          "flowing": false,
          "ended": true,
          "endEmitted": true,
          "reading": false,
          "constructed": true,
          "sync": false,
          "needReadable": false,
          "emittedReadable": false,
          "readableListening": false,
          "resumeScheduled": false,
          "errorEmitted": false,
          "emitClose": true,
          "autoDestroy": true,
          "destroyed": true,
          "errored": null,
          "closed": true,
          "closeEmitted": true,
          "defaultEncoding": "utf8",
          "awaitDrainWriters": null,
          "multiAwaitDrain": false,
          "readingMore": false,
          "dataEmitted": true,
          "decoder": null,
          "encoding": null
        },
        "_events": {},
        "_eventsCount": 2,
        "socket": null,
        "httpVersionMajor": 1,
        "httpVersionMinor": 1,
        "httpVersion": "1.1",
        "complete": true,
        "rawHeaders": [
          "Content-Type",
          "application/xml",
          "Date",
          "Wed, 01 Nov 2023 18:44:53 GMT",
          "Server",
          "WasabiS3/7.16.1950-2023-08-24-c6d9c0fd32 (head5)",
          "x-amz-id-2",
          "O41AOpQAXbdHkzNnMbpBkrnK7mMiNDvC30JQJXSocPw4aq7PdY6wZGn9DlsTcmnCemtUaGXWR6YM",
          "x-amz-request-id",
          "AD1E864FA7920379:A",
          "Transfer-Encoding",
          "chunked"
        ],
        "rawTrailers": [],
        "aborted": false,
        "upgrade": false,
        "url": "",
        "method": null,
        "statusCode": 403,
        "statusMessage": "Forbidden",
        "client": {
          "_tlsOptions": {
            "pipe": false,
            "secureContext": {
              "context": {}
            },
            "isServer": false,
            "requestCert": true,
            "rejectUnauthorized": true,
            "session": {
              "type": "Buffer",
              "data": [               
                147,
                117,
                ...
                1
              ]
            }
          },
          "_secureEstablished": true,
          "_securePending": false,
          "_newSessionPending": false,
          "_controlReleased": true,
          "secureConnecting": false,
          "_SNICallback": null,
          "servername": "s3.ap-northeast-1.wasabisys.com",
          "alpnProtocol": false,
          "authorized": true,
          "authorizationError": null,
          "encrypted": true,
          "_events": {
            "close": [
              null,
              null,
              null
            ]
          },
          "_eventsCount": 9,
          "connecting": false,
          "_hadError": false,
          "_parent": null,
          "_host": "s3.ap-northeast-1.wasabisys.com",
          "_closeAfterHandlingError": false,
          "_readableState": {
            "objectMode": false,
            "highWaterMark": 16384,
            "buffer": {
              "head": null,
              "tail": null,
              "length": 0
            },
            "length": 0,
            "pipes": [],
            "flowing": true,
            "ended": false,
            "endEmitted": false,
            "reading": true,
            "constructed": true,
            "sync": false,
            "needReadable": true,
            "emittedReadable": false,
            "readableListening": false,
            "resumeScheduled": false,
            "errorEmitted": false,
            "emitClose": false,
            "autoDestroy": true,
            "destroyed": false,
            "errored": null,
            "closed": false,
            "closeEmitted": false,
            "defaultEncoding": "utf8",
            "awaitDrainWriters": null,
            "multiAwaitDrain": false,
            "readingMore": false,
            "dataEmitted": true,
            "decoder": null,
            "encoding": null
          },
          "_writableState": {
            "objectMode": false,
            "highWaterMark": 16384,
            "finalCalled": false,
            "needDrain": false,
            "ending": false,
            "ended": false,
            "finished": false,
            "destroyed": false,
            "decodeStrings": false,
            "defaultEncoding": "utf8",
            "length": 0,
            "writing": false,
            "corked": 0,
            "sync": false,
            "bufferProcessing": false,
            "writecb": null,
            "writelen": 0,
            "afterWriteTickInfo": null,
            "buffered": [],
            "bufferedIndex": 0,
            "allBuffers": true,
            "allNoop": true,
            "pendingcb": 0,
            "constructed": true,
            "prefinished": false,
            "errorEmitted": false,
            "emitClose": false,
            "autoDestroy": true,
            "errored": null,
            "closed": false,
            "closeEmitted": false
          },
          "allowHalfOpen": false,
          "_sockname": null,
          "_pendingData": null,
          "_pendingEncoding": "",
          "_server": null,
          "ssl": {
            "_parent": {
              "reading": true,
              "onconnection": null
            },
            "reading": true
          },
          "_requestCert": true,
          "_rejectUnauthorized": true,
          "parser": null,
          "_httpMessage": null,
          "timeout": 0
        },
        "_consuming": true,
        "_dumped": false,
        "req": {
          "_events": {
            "socket": [
              null,
              null
            ]
          },
          "_eventsCount": 4,
          "outputData": [],
          "outputSize": 0,
          "writable": true,
          "destroyed": true,
          "_last": true,
          "chunkedEncoding": false,
          "shouldKeepAlive": true,
          "maxRequestsOnConnectionReached": false,
          "_defaultKeepAlive": true,
          "useChunkedEncodingByDefault": false,
          "sendDate": false,
          "_removedConnection": false,
          "_removedContLen": false,
          "_removedTE": false,
          "strictContentLength": false,
          "_contentLength": 0,
          "_hasBody": true,
          "_trailer": "",
          "finished": true,
          "_headerSent": true,
          "_closed": true,
          "_header": "DELETE /cdn.qien.tv/wta9bfb6df-b4fd-440a-8a10-879a2dbe1428-544.mp4?x-id=DeleteObject HTTP/1.1\r\nhost: s3.ap-northeast-1.wasabisys.com\r\nx-amz-user-agent: aws-sdk-js/3.335.0\r\nuser-agent: aws-sdk-js/3.335.0 os/linux/5.10.0-25-amd64 lang/js md/nodejs/16.20.2 api/s3/3.335.0\r\namz-sdk-invocation-id: 26d2359d-85ba-4a2d-b1b6-512bbf1533b8\r\namz-sdk-request: attempt=1; max=3\r\nx-amz-date: 20231101T184452Z\r\nx-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\r\nauthorization: AWS4-HMAC-SHA256 Credential=FBYAD8PBUY8VHMLIXAWD/20231101/ap-northeast-1/s3/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;host;x-amz-content-sha256;x-amz-date;x-amz-user-agent, Signature=2c4c18d37a650b76fc493b91cc3c280f7646c4f9f8ecb4ba627c612cb7d8581a\r\nConnection: keep-alive\r\n\r\n",
          "_keepAliveTimeout": 0,
          "agent": {
            "_events": {},
            "_eventsCount": 2,
            "defaultPort": 443,
            "protocol": "https:",
            "options": {
              "keepAlive": true,
              "maxSockets": 50,
              "path": null
            },
            "requests": {},
            "sockets": {
              "s3.ap-northeast-1.wasabisys.com:443:::::::::::::::::::::": [
                {
                  "_tlsOptions": {
                    "pipe": false,
                    "secureContext": {
                      "context": {}
                    },
                    "isServer": false,
                    "requestCert": true,
                    "rejectUnauthorized": true,
                    "session": {
                      "type": "Buffer",
                      "data": [
                        48,
                        130,
                        7,
                        ...
                        2,
                        1,
                        1
                      ]
                    }
                  },
                  "_secureEstablished": true,
                  "_securePending": false,
                  "_newSessionPending": false,
                  "_controlReleased": true,
                  "secureConnecting": false,
                  "_SNICallback": null,
                  "servername": "s3.ap-northeast-1.wasabisys.com",
                  "alpnProtocol": false,
                  "authorized": true,
                  "authorizationError": null,
                  "encrypted": true,
                  "_events": {
                    "close": [
                      null,
                      null,
                      null,
                      null
                    ],
                    "end": [
                      null,
                      null
                    ],
                    "timeout": [
                      null,
                      null
                    ]
                  },
                  "_eventsCount": 11,
                  "connecting": false,
                  "_hadError": false,
                  "_parent": null,
                  "_host": "s3.ap-northeast-1.wasabisys.com",
                  "_closeAfterHandlingError": false,
                  "_readableState": {
                    "objectMode": false,
                    "highWaterMark": 16384,
                    "buffer": {
                      "head": null,
                      "tail": null,
                      "length": 0
                    },
                    "length": 0,
                    "pipes": [],
                    "flowing": true,
                    "ended": false,
                    "endEmitted": false,
                    "reading": true,
                    "constructed": true,
                    "sync": false,
                    "needReadable": true,
                    "emittedReadable": false,
                    "readableListening": false,
                    "resumeScheduled": false,
                    "errorEmitted": false,
                    "emitClose": false,
                    "autoDestroy": true,
                    "destroyed": false,
                    "errored": null,
                    "closed": false,
                    "closeEmitted": false,
                    "defaultEncoding": "utf8",
                    "awaitDrainWriters": null,
                    "multiAwaitDrain": false,
                    "readingMore": false,
                    "dataEmitted": false,
                    "decoder": null,
                    "encoding": null
                  },
                  "_writableState": {
                    "objectMode": false,
                    "highWaterMark": 16384,
                    "finalCalled": false,
                    "needDrain": false,
                    "ending": false,
                    "ended": false,
                    "finished": false,
                    "destroyed": false,
                    "decodeStrings": false,
                    "defaultEncoding": "utf8",
                    "length": 0,
                    "writing": false,
                    "corked": 0,
                    "sync": false,
                    "bufferProcessing": false,
                    "writecb": null,
                    "writelen": 0,
                    "afterWriteTickInfo": null,
                    "buffered": [],
                    "bufferedIndex": 0,
                    "allBuffers": true,
                    "allNoop": true,
                    "pendingcb": 0,
                    "constructed": true,
                    "prefinished": false,
                    "errorEmitted": false,
                    "emitClose": false,
                    "autoDestroy": true,
                    "errored": null,
                    "closed": false,
                    "closeEmitted": false
                  },
                  "allowHalfOpen": false,
                  "_sockname": null,
                  "_pendingData": null,
                  "_pendingEncoding": "",
                  "_server": null,
                  "ssl": {
                    "_parent": {
                      "reading": true,
                      "onconnection": null
                    },
                    "reading": true
                  },
                  "_requestCert": true,
                  "_rejectUnauthorized": true,
                  "parser": {
                    "0": null,
                    "5": null,
                    "6": null,
                    "_headers": [],
                    "_url": "",
                    "incoming": null,
                    "outgoing": {
                      "_events": {
                        "socket": [
                          null,
                          null
                        ]
                      },
                      "_eventsCount": 4,
                      "outputData": [],
                      "outputSize": 0,
                      "writable": true,
                      "destroyed": false,
                      "_last": true,
                      "chunkedEncoding": false,
                      "shouldKeepAlive": true,
                      "maxRequestsOnConnectionReached": false,
                      "_defaultKeepAlive": true,
                      "useChunkedEncodingByDefault": false,
                      "sendDate": false,
                      "_removedConnection": false,
                      "_removedContLen": false,
                      "_removedTE": false,
                      "strictContentLength": false,
                      "_contentLength": 0,
                      "_hasBody": true,
                      "_trailer": "",
                      "finished": true,
                      "_headerSent": true,
                      "_closed": false,
                      "_header": "GET /cdn.qien.tv/?list-type=2&prefix=qienhls%2F09b5d765-c05c-486f-8498-d43a78893686 HTTP/1.1\r\nhost: s3.ap-northeast-1.wasabisys.com\r\nx-amz-user-agent: aws-sdk-js/3.335.0\r\nuser-agent: aws-sdk-js/3.335.0 os/linux/5.10.0-25-amd64 lang/js md/nodejs/16.20.2 api/s3/3.335.0\r\namz-sdk-invocation-id: 225a3449-d988-431a-a85e-925f5f86d33a\r\namz-sdk-request: attempt=1; max=3\r\nx-amz-date: 20231101T184452Z\r\nx-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\r\nauthorization: AWS4-HMAC-SHA256 Credential=FBYAD8PBUY8VHMLIXAWD/20231101/ap-northeast-1/s3/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;host;x-amz-content-sha256;x-amz-date;x-amz-user-agent, Signature=932dc727b0c65e07b795a3c879598ed4fda3d5c18884a9da93c11b569719b3af\r\nConnection: keep-alive\r\n\r\n",
                      "_keepAliveTimeout": 0,
                      "method": "GET",
                      "path": "/cdn.qien.tv/?list-type=2&prefix=qienhls%2F09b5d765-c05c-486f-8498-d43a78893686",
                      "_ended": false,
                      "res": null,
                      "aborted": false,
                      "upgradeOrConnect": false,
                      "maxHeadersCount": null,
                      "reusedSocket": false,
                      "host": "s3.ap-northeast-1.wasabisys.com",
                      "protocol": "https:"
                    },
                    "maxHeaderPairs": 2000,
                    "_consumed": false
                  },
                  "timeout": 0
                }
              ]
            },
            "freeSockets": {
              "s3.ap-northeast-1.wasabisys.com:443:::::::::::::::::::::": [
                null
              ]
            },
            "keepAliveMsecs": 1000,
            "keepAlive": true,
            "maxSockets": 50,
            "maxFreeSockets": 256,
            "scheduling": "lifo",
            "maxTotalSockets": null,
            "totalSocketCount": 2,
            "maxCachedSessions": 100,
            "_sessionCache": {
              "map": {
                "s3.ap-northeast-1.wasabisys.com:443:::::::::::::::::::::": {
                  "type": "Buffer",
                  "data": [
                    48,
                    130,
                    7,
                    201,
                    2,
                    ...
                    1,
                    1
                  ]
                }
              },
              "list": [
                "s3.ap-northeast-1.wasabisys.com:443:::::::::::::::::::::"
              ]
            }
          },
          "method": "DELETE",
          "path": "/cdn.qien.tv/wta9bfb6df-b4fd-440a-8a10-879a2dbe1428-544.mp4?x-id=DeleteObject",
          "_ended": true,
          "aborted": false,
          "timeoutCb": null,
          "upgradeOrConnect": false,
          "parser": null,
          "maxHeadersCount": null,
          "reusedSocket": false,
          "host": "s3.ap-northeast-1.wasabisys.com",
          "protocol": "https:"
        }
      }
    }
  }
}

Yes, there’s a permission issue where PeerTube doesn’t seem to have the right to delete files in the bucket.

Thanks. I have figure it out through adding a sub-user for operration permission in the bucket.