cedaro / satispress

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

Error 500 on ?satispress_route=composer/packages.json #143

Closed alapiere closed 3 years ago

alapiere commented 3 years ago

Hi, I'm trying fist time satispress, I've setup everything as instructed, when I try 'composer update' from client, I got, after entering credentials :

 [Composer\Downloader\TransportException]                                                                                    
  The "https://myweb.site/?satispress_route=composer/packages.json" file could not be downloaded (HTTP/1.1 500 In  
  ternal Server Error)

Don't see anything in error log unfortunately

If I access directly the url on satispress installation, I had same Error 500 for awhile, Fatal error: Uncaught SatisPress\Exception\HttpException: Forbidden resource requested

I refreshed all server caches, retried a dozen of times, now I have BASIC AUTH and working fine after that.

In troubleshooting , I see something about BASIC AUTH but I'm with ngninx and don't have access to site's configuration. (and it should be a 401 in this case, not a 500 , right ?)

Please help ! (tell me what I can provide to help instigating)

alapiere commented 3 years ago

just to make sure, it has nothing to do with authentication (if I enter bad credentials, I got a normal "Invalid credentials .. aborting" error , not this Internal Server error)

alapiere commented 3 years ago

I manage now to reproduce directly on satispress installtion :

Fatal error: Uncaught Pimple\Exception\UnknownIdentifierException: Identifier "composer/packages.json" is not defined. in /www/wpcontroljengo_729/public/wp-content/plugins/satispress/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php:62 Stack trace: #0 /www/wpcontroljengo_729/public/wp-content/plugins/satispress/src/Provider/RequestHandler.php(175): Pimple\Psr11\ServiceLocator->get('composer/packag...') #1 /www/wpcontroljengo_729/public/wp-content/plugins/satispress/src/Provider/RequestHandler.php(89): SatisPress\Provider\RequestHandler->get_route_controller('composer/packag...') #2 /www/wpcontroljengo_729/public/wp-includes/class-wp-hook.php(287): SatisPress\Provider\RequestHandler->dispatch(Object(WP)) #3 /www/wpcontroljengo_729/public/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array) #4 /www/wpcontroljengo_729/public/wp-includes/plugin.php(551): WP_Hook->do_action(Array) #5 /www/wpcontroljengo_729/public/wp-includes/class-wp.php(388): do_action_ref_array('parse_request', Array) #6 /www/wpcon in /www/wpcontroljengo_729/public/wp-content/plugins/satispress/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php on line 62

bradyvercher commented 3 years ago

It sounds like you probably don't have pretty permalinks enabled. Can you enable those and try again?

alapiere commented 3 years ago

I did not .... I suppose "pretty permalnk" is "Post name" Permalink option.. I registered that .. and it works perfectly fine .. Thank you very much for answering and giving me this solution Thanks for this very nice plugin/ service, an incredibly easy solution to a tough problem But I feel pretty frustrated I must admit, I've stumbled upon this error 500 issue for hours .. couldn't this foolproofing in plugin code ? it should be easy enough to check the activated permalink option instead of crashing ? Or to bypass it by copying a proxy file to root ?

bradyvercher commented 3 years ago

I feel your frustration, @alapiere. This wasn't a known issue beforehand and I guessed that was the problem based on the error you posted. Pretty permalinks should be any of the options aside from "plain." I believe WordPress enables them by default these days, so I guess no one else had run into the issue before.

alapiere commented 3 years ago

Well, to be constructive for future users landing here from google, default permalink is supposed to be the one not working, ?p=N source : https://wordpress.org/support/article/using-permalinks/ I'm not sure why I'm the only one with this issue though. But in my experience, 500 errors are always something not expected thus not catched producing unexpected variable situation. Since this is, according to source, supposed to be the default buggy situation, I guess this is a legitmate bug that should be tracked for fixing. Glad to know it's easily fixed when you know why and how . Since it's open source, I suppose I should suggest a PR to fix this , but I'm a little code-rusty..

alapiere commented 3 years ago

Great, thanks !