From a9cb29dfc101f57c8fd84f886f4cd18c63f28b4e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 17 Sep 2024 08:35:54 +0200 Subject: [PATCH] More info when logging the request --- server/core/helpers/requests.ts | 6 ++++++ server/core/lib/activitypub/playlists/create-update.ts | 4 ++-- server/core/lib/activitypub/process/process-delete.ts | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/server/core/helpers/requests.ts b/server/core/helpers/requests.ts index b2ce1c65d..f8a0c3e2f 100644 --- a/server/core/helpers/requests.ts +++ b/server/core/helpers/requests.ts @@ -14,9 +14,13 @@ const lTags = loggerTagsFactory('request') export interface PeerTubeRequestError extends Error { statusCode?: number + responseBody?: any responseHeaders?: any + requestHeaders?: any + requestUrl?: any + requestMethod?: any } export type PeerTubeRequestOptions = { @@ -251,6 +255,8 @@ function buildRequestError (error: RequestError) { if (error.options) { newError.requestHeaders = error.options.headers + newError.requestUrl = error.options.url + newError.requestMethod = error.options.method } return newError diff --git a/server/core/lib/activitypub/playlists/create-update.ts b/server/core/lib/activitypub/playlists/create-update.ts index 7de5664bd..257224fb1 100644 --- a/server/core/lib/activitypub/playlists/create-update.ts +++ b/server/core/lib/activitypub/playlists/create-update.ts @@ -38,7 +38,7 @@ async function createAccountPlaylists (playlistUrls: string[]) { return createOrUpdateVideoPlaylist(playlistObject) } catch (err) { - logger.warn('Cannot add playlist element %s.', playlistUrl, { err, ...lTags(playlistUrl) }) + logger.warn('Cannot add playlist element ' + playlistUrl, { err, ...lTags(playlistUrl) }) } }, { concurrency: CRAWL_REQUEST_CONCURRENCY }) } @@ -149,7 +149,7 @@ async function buildElementsDBAttributes (elementUrls: string[], playlist: MVide elementsToCreate.push(playlistElementObjectToDBAttributes(elementObject, playlist, video)) } catch (err) { - logger.warn('Cannot add playlist element %s.', elementUrl, { err, ...lTags(playlist.uuid, playlist.url) }) + logger.warn('Cannot add playlist element ' + elementUrl, { err, ...lTags(playlist.uuid, playlist.url) }) } }, { concurrency: CRAWL_REQUEST_CONCURRENCY }) diff --git a/server/core/lib/activitypub/process/process-delete.ts b/server/core/lib/activitypub/process/process-delete.ts index 0e9f8888e..1c1404fcb 100644 --- a/server/core/lib/activitypub/process/process-delete.ts +++ b/server/core/lib/activitypub/process/process-delete.ts @@ -29,7 +29,7 @@ async function processDeleteActivity (options: APProcessorOptions