cedaro / satispress

Expose installed WordPress plugins and themes as Composer packages.
500 stars 48 forks source link

[Composer\Downloader\TransportException] The <filename> file could not be downloaded (HTTP/1.1 500 Internal Server Error) #166

Closed acalvino4 closed 2 years ago

acalvino4 commented 2 years ago

After setting up a satispress server, running composer install, and being authenticated, I am running into the error in the title: [Composer\Downloader\TransportException] The <filename> file could not be downloaded (HTTP/1.1 500 Internal Server Error)

I have disabled all plugins besides satispress.

Here is the output of composer diagnose:

Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 2.1.9
PHP version: 7.4.23
PHP binary path: /usr/local/Cellar/php@7.4/7.4.23/bin/php
OpenSSL version: OpenSSL 1.1.1l  24 Aug 2021
cURL version: 7.78.0 libz 1.2.11 ssl (SecureTransport) OpenSSL/1.1.1l
zip: extension present, unzip present, 7-Zip not available

Here is my apache config:

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerAdmin webmaster@localhost

        ServerName <sitename>
        ServerAlias www.<sitename>

        DocumentRoot /var/www/html

        <Directory /var/www/html/>
            Options FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]

SSLCertificateFile /etc/letsencrypt/live/<sitename>/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/<sitename>/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

Looking at my apache error log, there are many of the following error:

[Wed Oct 06 03:57:19.877358 2021] [php:error] [pid 12034] [client 65.114.192.26:53201] PHP Fatal error:  Uncaught TypeError: preg_replace(): Argument #3 ($subject) must be of type array|string, bool given in /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php:149\nStack trace:\n#0 /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php(149): preg_replace()\n#1 /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php(162): SatisPress\\Provider\\RequestHandler->send_header()\n#2 /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php(102): SatisPress\\Provider\\RequestHandler->send_headers()\n#3 /var/www/html/wp-includes/class-wp-hook.php(303): SatisPress\\Provider\\RequestHandler->dispatch()\n#4 /var/www/html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters()\n#5 /var/www/html/wp-includes/plugin.php(518): WP_Hook->do_action()\n#6 /var/www/html/wp-includes/class-wp.php(388): do_action_ref_array()\n#7 /var/www/html/wp-includes/class-wp.php(750): WP->parse_request()\n#8 /var/www/html/wp-includes/functions.php(1291): WP->main()\n#9 /var/www/html/wp-blog-header.php(16): wp()\n#10 /var/www/html/index.php(17): require('...')\n#11 {main}\n  thrown in /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php on line 149
[Wed Oct 06 03:57:19.878216 2021] [php:error] [pid 12262] [client 65.114.192.26:53200] PHP Fatal error:  Uncaught TypeError: preg_replace(): Argument #3 ($subject) must be of type array|string, bool given in /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php:149\nStack trace:\n#0 /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php(149): preg_replace()\n#1 /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php(162): SatisPress\\Provider\\RequestHandler->send_header()\n#2 /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php(102): SatisPress\\Provider\\RequestHandler->send_headers()\n#3 /var/www/html/wp-includes/class-wp-hook.php(303): SatisPress\\Provider\\RequestHandler->dispatch()\n#4 /var/www/html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters()\n#5 /var/www/html/wp-includes/plugin.php(518): WP_Hook->do_action()\n#6 /var/www/html/wp-includes/class-wp.php(388): do_action_ref_array()\n#7 /var/www/html/wp-includes/class-wp.php(750): WP->parse_request()\n#8 /var/www/html/wp-includes/functions.php(1291): WP->main()\n#9 /var/www/html/wp-blog-header.php(16): wp()\n#10 /var/www/html/index.php(17): require('...')\n#11 {main}\n  thrown in /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php on line 149
[Wed Oct 06 03:57:19.883849 2021] [php:error] [pid 12349] [client 65.114.192.26:53198] PHP Fatal error:  Uncaught TypeError: preg_replace(): Argument #3 ($subject) must be of type array|string, bool given in /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php:149\nStack trace:\n#0 /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php(149): preg_replace()\n#1 /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php(162): SatisPress\\Provider\\RequestHandler->send_header()\n#2 /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php(102): SatisPress\\Provider\\RequestHandler->send_headers()\n#3 /var/www/html/wp-includes/class-wp-hook.php(303): SatisPress\\Provider\\RequestHandler->dispatch()\n#4 /var/www/html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters()\n#5 /var/www/html/wp-includes/plugin.php(518): WP_Hook->do_action()\n#6 /var/www/html/wp-includes/class-wp.php(388): do_action_ref_array()\n#7 /var/www/html/wp-includes/class-wp.php(750): WP->parse_request()\n#8 /var/www/html/wp-includes/functions.php(1291): WP->main()\n#9 /var/www/html/wp-blog-header.php(16): wp()\n#10 /var/www/html/index.php(17): require('...')\n#11 {main}\n  thrown in /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php on line 149
acalvino4 commented 2 years ago

I enabled debugging - here is the stack trace

[06-Oct-2021 04:05:11 UTC] PHP Fatal error:  Uncaught TypeError: preg_replace(): Argument #3 ($subject) must be of type array|string, bool given in /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php:149
Stack trace:
#0 /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php(149): preg_replace()
#1 /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php(162): SatisPress\Provider\RequestHandler->send_header()
#2 /var/www/html/wp-content/plugins/satispress/src/Provider/RequestHandler.php(102): SatisPress\Provider\RequestHandler->send_headers()
#3 /var/www/html/wp-includes/class-wp-hook.php(303): SatisPress\Provider\RequestHandler->dispatch()
#4 /var/www/html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters()
#5 /var/www/html/wp-includes/plugin.php(518): WP_Hook->do_action()
#6 /var/www/html/wp-includes/class-wp.php(388): do_action_ref_array()
#7 /var/www/html/wp-includes/class-wp.php(750): WP->parse_request()
#8 /var/www/html/wp-includes/functions.php(1291): WP->main()
#9 /var/www/html/wp-blog-header.php(16): wp()
#10 /var/www/html/index.php(17): require('...')
acalvino4 commented 2 years ago

And here is the relevant part of my composer.json

{
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org",
      "only": ["wpackagist-plugin/*", "wpackagist-theme/*"]
    }, {
      "type": "composer",
      "url": "https://<sitename>/satispress/"
    }
  ],
    "require": {
        "php": ">=7.4",
    "composer/installers": "^1.0.1",
    "roots/wordpress": "^5.8.1",
    "wpackagist-plugin/acf-extended": "^0.8.8.6",
    "wpackagist-plugin/post-snippets": "^3.0",
...more packages from wpackagist...

    "gem-satispress/acfml": "^1.6.1",
    "gem-satispress/advanced-custom-fields-pro": "^5.10.2",
...more packages from satispress server...
  "require-dev": {
    "squizlabs/php_codesniffer": "^3.6.0",
    "roave/security-advisories": "dev-master"
  },
  "config": {
    "optimize-autoloader": true,
    "preferred-install": "dist"
  },
  "minimum-stability": "dev",
  "prefer-stable": true,
  ...
}
acalvino4 commented 2 years ago

Turns out this is the exact same issue reported in https://github.com/cedaro/satispress/issues/165. Downgrading my Satispress server to php 7.4 fixed the issue.