Some videos won't upload - EDIT: NodeJS 12.9-12.19.x causes timeouts after 60 seconds

Hello everyone,

I am a simple peertube user, I am not running a server.
I have been creating (with OBS) and uploading dozens of video on peertube from firefox. For some reason I sometimes get an error message when I want to upload a video :

Any idea what I shoud do ?
Thanks for your help!

hi @verduron,

This sounds like a misconfigured server, as uploading a video shouldn’t result in this kind of errors. I suggest getting in touch with your instance administrator first.

Thanks for your input @rigelk ! I will do that.
What surprises me is that it works for smaller videos, and it used to work for much larger ones.
Have a good day.

The instance administrator might have further limited the maximum body size in its reverse proxy configuration :thinking:

The admin didn’t have any trouble uploading the video himself. It doesn’t come from a limitation of the server.
I tried to clean the cache and to remove the add ons from my Firefox browser, it didn’t help. Switching to Chromium (Linux) didn’t do the trick either.

Interesting, but very strange. In any case, this 502 error is related to the reverse-proxy connection with the backend, not your browser.

Could your sysadmin provide more details about how the reverse-proxy is configured?

I’m the sysadmin for this instance. This case is quite strange. I’ve already had this kind of error when a user with a slow internet connection uploads a big file -> with my previous RP configuration ProxyTimeout 600 -> 10 minutes; when the upload ends after the timeout -> ERROR

My new RP configuration is :
LimitRequestBody 4294967294
ProxyTimeout 7200

For this specific case, @verduron can’t upload a short video. He sends me the file (39 Mo). I upload the file without any error.

I use this apache RP configuration available at to configure my instance

with a little difference

ProxyTimeout 600 -> 7200

my current configuration

cat /etc/apache2/sites-enabled/

<IfModule mod_ssl.c>
<VirtualHost *:443>
   Redirect Permanent /
   ErrorLog ${APACHE_LOG_DIR}/ssl_error_peertube.log
   CustomLog ${APACHE_LOG_DIR}/ssl_access_peertube.log combined

   Header always set X-Content-Type-Options nosniff
   Header always set X-Robots-Tag none
   Header always set X-XSS-Protection "1; mode=block"

        # Activate http/2
        Protocols h2 h2c http/1.1

        H2Push          on
        H2PushPriority  *                       after
        H2PushPriority  text/css                before
        H2PushPriority  image/jpeg              after   32
        H2PushPriority  image/png               after   32
        H2PushPriority  application/javascript  interleaved

        # Hard limit, PeerTube does not support videos > 4GB
        LimitRequestBody 4294967294

        # Set caching on assets for 1 year
        <FilesMatch ^/client/(.*\.(js|css|woff2|otf|ttf|woff|eot))$>
                Header append Cache-Control "public, max-age=31536000, immutable"
        AliasMatch ^/client/(.*\.(js|css|woff2|otf|ttf|woff|eot))$ /data/www-data/peertube/peertube-latest/client/dist/$1

        # Set caching on image files for 1 year
        <FilesMatch ^/static/(thumbnails|avatars)/(.*)$>
                Header append Cache-Control "public, max-age=31536000, immutable"
        AliasMatch ^/static/(thumbnails|avatars)/(.*)$ /data/www-data/peertube/storage/$1/$2

        # Bypass PeerTube webseed route for better performances
        Alias /static/webseed /data/www-data/peertube/storage/videos
        <Location /static/webseed>
                # Clients usually have 4 simultaneous webseed connections, so the real limit is 3MB/s per client
                SetOutputFilter RATE_LIMIT
                SetEnv rate-limit 1250

                SetEnvIf Request_Method "GET" GETMETH=1

                Header set Access-Control-Allow-Origin "*" env=GETMETH
                Header set Access-Control-Allow-Headers "Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type" env=GETMETH
                Header set Access-Control-Allow-Methods "GET, OPTIONS" env=GETMETH
                Header set toto "foo" env=GETMETH
                SetEnvIf GETMETH "1" dontlog

                SetEnvIf Request_Method "OPTIONS" OPTIONSMETH=1

                Header set Access-Control-Allow-Origin "*" env=OPTIONSMETH
                Header set Access-Control-Allow-Headers "Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type" env=OPTIONSMETH
                Header set Access-Control-Allow-Methods "GET, OPTIONS" env=OPTIONSMETH
                Header set Access-Control-Max-Age "1000" env=OPTIONSMETH
                Header set Content-Type "text/plain charset=UTF-8" env=OPTIONSMETH
                Header set Content-Length "0" env=OPTIONSMETH

        <Location /videos/embed>
                Header unset X-Frame-Options

        ProxyPreserveHost On
        ProxyRequests Off
        ProxyTimeout 7200

        # Websocket tracker
        RewriteEngine On
        RewriteCond %{HTTP:Upgrade} websocket [NC]
        RewriteRule /(.*) ws://$1 [P,L]

        <Location />

SSLCertificateFile /etc/letsencrypt/live/
SSLCertificateKeyFile /etc/letsencrypt/live/
Include /etc/letsencrypt/options-ssl-apache.conf

cat /etc/letsencrypt/options-ssl-apache.conf

SSLEngine on

# Intermediate configuration, tweak to your needs
SSLProtocol             all -SSLv2 -SSLv3
SSLHonorCipherOrder     on
SSLCompression          off

SSLOptions +StrictRequire

# Add vhost name to log entries:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined
LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common

root@srv:/etc/apache2# apachectl -M | egrep "proxy|http2|rate|header|ssl|rewrite"

headers_module (shared)
http2_module (shared)
proxy_module (shared)
proxy_http_module (shared)
proxy_wstunnel_module (shared)
ratelimit_module (shared)
rewrite_module (shared)
ssl_module (shared)

AH. I wrote this file, and explicitly marked it as outdated… It lacks nearly all performance optimizations, and it wasn’t checked for security ever since. Some other parts, like the request body maximum size you mention, were since modified in the reference Nginx configuration to 8Gb.

I’m no Apache expert, so I don’t know how it handles timeouts (responding with a 502?!), especially with a proxypass directive. In Nginx we also tune the timeout for proxypass.

I’ve just seen the OUTDATED status :sweat_smile:

I will have to migrate my web hosting stack from apache2 to nginx in order to have the supported configuration for peertube. That’s something I’m working on but I have several complexe Vhosts to migrate :dizzy_face:

I look forward to the next version of peertube with live broadcasting. I was planning to change my web hosting stack technology (apache2 -> nginx) for this version, to be able to use the rtmp protocol.

Eureka -

Finally I haven’t got any problems with my apache configuration. The problem is related to node.js installed version (12.19.1)

I’ve just downgraded my nodejs version from 12.19.1 to 12.16.0 and everything is working fine now.

link to the article that led me to the solution :

The solution, as just as it might be, is not sourced nor verifiable in the release notes or NodeJS changelog. Do you have other sources?

i’ve found this issue on nodejs

1 Like

Thanks a bunch! We’re going to be more carefull with errors reporting timeouts when it comes to these nodejs versions.