Cannot send metrics to the server

Hello,

PeerTube version 6.0.4
everything is working but the log files are filled with this error msg
url is accessable via browser and curl on the server

how to reproduce the
stackTrace": « NetworkError when attempting to fetch resource.\n »,

#033[31merror#033[39m: Client log: Cannot send metrics to the server. {
2024-05-21T08:06:30.982619+02:00 www peertube[468766]: « userAgent »: « Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:124.0) Gecko/20100101 Firefox/124.0 »,
2024-05-21T08:06:30.982700+02:00 www peertube[468766]: « stackTrace »: « NetworkError when attempting to fetch resource.\n »,
2024-05-21T08:06:30.982755+02:00 www peertube[468766]: « url »: « Qu'est-ce que le CDS ? - DioxiTube »
2024-05-21T08:06:30.982811+02:00 www peertube[468766]: }

oder version:

[dioxitube.com:443] 2024-05-22 20:17:41.247 #033[31merror#033[39m: Client log: Cannot send metrics to the server. {
2024-05-22T20:17:41.249060+02:00 www peertube[600695]: « userAgent »: « Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 »,
2024-05-22T20:17:41.249266+02:00 www peertube[600695]: « stackTrace »: « Failed to fetch\nTypeError: Failed to fetch\n at https://dioxitube.com/client/en-US/polyfills.1a8ab2f5d42ff008.js:1:48645\n at O. (https://dioxitube.com/client/en-US/polyfills.1a8ab2f5d42ff008.js:1:42574)\n/n) at https://dioxitube.com/client/en-US/9067.77ab49c4f67c0145.js:1:405016\n at T. (https://dioxitube.com/client/en-US/polyfills.1a8ab2f5d42ff008.js:1:57632)\n/n) at d.invokeTask (https://dioxitube.com/client/en-US/polyfills.1a8ab2f5d42ff008.js:1:36278)\n/n) at H.runTask (https://dioxitube.com/client/en-US/polyfills.1a8ab2f5d42ff008.js:1:31575)\n/n) at invokeTask (https://dioxitube.com/client/en-US/polyfills.1a8ab2f5d42ff008.js:1:37337)\n/n) at invoke (https://dioxitube.com/client/en-US/polyfills.1a8ab2f5d42ff008.js:1:37238)\n/n) at p.args. (https://dioxitube.com/client/en-US/polyfills.1a8ab2f5d42ff008.js:1:57344) »,
2024-05-22T20:17:41.249374+02:00 www peertube[600695]: « url »: « "Il Processo di Creazione del CDS con il Dr. Kalcker: Una Guida Passo dopo Passo" - DioxiTube »
2024-05-22T20:17:41.249434+02:00 www peertube[600695]: }

Tips: You can use the « preformatted text » functionnality of this forum to paste more readable logs.

These logs are « client logs »: error logs that users have in their browser, and that are send to the backend for debugging purpose (this can be disabled in the Peertube configuration).
There can be many reason for such logs. Here, a request that send metrics failed. This is probably an ad blocker used by one of your user.

added to nginx conf

location /api/v1/server/logs/client {
limit_req zone=mylimit burst=2 nodelay;
}

than got

2024/06/01 14:07:25 [error] 350322#350322: *18657 open() "/var/www/peertube/storage/api/v1/server/logs/client" failed (2: No such file or directory), client: 109.118.115.199, server: dioxitube.com, request: "POST /api/v1/server/logs/client HTTP/2.0", host: "dioxitube.com", referrer: "https://dioxitube.com/"
2024/06/01 14:07:25 [error] 350322#350322: *18657 open() "/var/www/peertube/storage/api/v1/server/logs/client" failed (2: No such file or directory), client: 109.118.115.199, server: dioxitube.com, request: "POST /api/v1/server/logs/client HTTP/2.0", host: "dioxitube.com", referrer: "https://dioxitube.com/"
2024/06/01 14:09:05 [error] 350322#350322: *19367 open() "/var/www/peertube/storage/api/v1/server/logs/client" failed (2: No such file or directory), client: 95.143.58.124, server: dioxitube.com, request: "POST /api/v1/server/logs/client HTTP/2.0", host: "dioxitube.com", referrer: "https://dioxitube.com/w/pKZLSKH7FFExixv3CHibhs"

mkdir -p /var/www/peertube/storage/api/v1/server/logs/
chown -R peertube:peertube /var/www/peertube/storage/api/v1/server/logs/
chmod -R 755 /var/www/peertube/storage/api/v1/server/logs/

nginx.conf

http {
    limit_req_zone $binary_remote_addr zone=mylimit:10m rate=1r/s;
        ...
}