omeka-s-modules / ValueSuggest

GNU General Public License v3.0
10 stars 13 forks source link

Suggester for PACTOLS returns an error #57

Closed miledrousset closed 3 years ago

miledrousset commented 3 years ago

Hello, I think that since the passage to the module (Laminas \ Http \ Client), the search in the PACTOLS thesaurus no longer passes, I have an error (state 500 Internal Server Error VersionHTTP / 1.1 Referent policy (strict-origin-when-cross-origin).

My REST API services (java) do return a header ("Access-Control-Allow-Origin", "*").

Could you tell me what I need to correct? on the REST API side or in ValueSuggest?

here is an example of a query : pactols.frantiq.fr/opentheso/api/search?q=amphore&lang=fr&theso=TH_1&format=jsonld

Thank you

jimsafley commented 3 years ago

I cannot reproduce the error. PACTOLS works for me. What exact steps did you take to encounter the error?

miledrousset commented 3 years ago

Here are the steps: I installed OmekaS version 3.0.2, and the valueSuggest module version 1.8.0 I created a template with a field (subject), I chose the data type (pactols subject). I added a new Item, then selected the prepared template. By entering values in the (Subject) field, I don't have autocompletion, but rather a security error in the header: Strict-origin-when-cross-origin referrer policy

Using a web browser, the query works fine https://pactols.frantiq.fr/opentheso/api/search?q=vase&lang=fr&theso=TH_1&format=jsonld

The same problem occurs with the source: Homosaurus

Capture d’écran 2021-08-10 à 12 03 54 Capture d’écran 2021-08-10 à 12 55 08

jimsafley commented 3 years ago

Check your PHP error log. A 500 Internal Server Error suggests there was an error when making the proxy request. That error would have been logged. If the module worked before, perhaps your server environment changed in the meantime.

miledrousset commented 3 years ago

Hello, I am a little desperate, I have tried everything, but I still have the same error! The logs do not give anything since the connection is not made, my program does not receive the request, it is rejected before. You say that (for you it works), I'm amazed, I also have the same problem for (Homosaurus). Could you describe to me your test environment? (I have attached a screenshot to show that if I go through a program independent of ValueSuggest, Capture d’écran 2021-08-31 à 10 23 50 everything works fine) Thank you

jimsafley commented 3 years ago

It appears that a connection is made and your server responds with a 500 Internal Server Error. PHP usually logs those errors. In your browser's debugger, after getting a 500 error, click on "Réponse" and see if there's an error message somewhere in the response.

miledrousset commented 3 years ago

Here is the error message in (response). Capture d’écran 2021-08-31 à 11 57 46 Capture d’écran 2021-08-31 à 11 57 27

I am using version (7.4.16) of PHP. I have no error message in the logs

jimsafley commented 3 years ago

Please follow these directions to retrieve error messages. Once you've done that you should get a more helpful message that should explain the error.

miledrousset commented 3 years ago

here is the error message after switching to development mode

Laminas\Http\Client\Adapter\Exception\RuntimeException Unable to enable crypto on TCP connection pactols.frantiq.fr: make sure the "sslcafile" or "sslcapath" option are properly set for the environment.

Details:

ErrorException: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-http/src/Client/Adapter/Socket.php:320 Stack trace:

0 [internal function]: Laminas\Stdlib\ErrorHandler::addError(2, 'stream_socket_e...', '/Applications/M...', 320, Array)

1 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-http/src/Client/Adapter/Socket.php(320): stream_socket_enable_crypto(Resource id #584, true, 57)

2 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-http/src/Client.php(1445): Laminas\Http\Client\Adapter\Socket->connect('pactols.frantiq...', 443, true)

3 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-http/src/Client.php(945): Laminas\Http\Client->doRequest(Object(Laminas\Uri\Http), 'GET', true, Array, '')

4 /Applications/MAMP/htdocs/omeka-s/modules/ValueSuggest/src/Suggester/Pactols/PactolsSujets.php(33): Laminas\Http\Client->send()

5 /Applications/MAMP/htdocs/omeka-s/modules/ValueSuggest/src/Controller/IndexController.php(58): ValueSuggest\Suggester\Pactols\PactolsSujets->getSuggestions('vase', 'fr')

6 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/Controller/AbstractActionController.php(77): ValueSuggest\Controller\IndexController->proxyAction()

7 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\Controller\AbstractActionController->onDispatch(Object(Laminas\Mvc\MvcEvent))

8 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))

9 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php(103): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))

10 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/DispatchListener.php(139): Laminas\Mvc\Controller\AbstractController->dispatch(Object(Laminas\Http\PhpEnvironment\Request), Object(Laminas\Http\PhpEnvironment\Response))

11 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\DispatchListener->onDispatch(Object(Laminas\Mvc\MvcEvent))

12 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))

13 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/Application.php(331): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))

14 /Applications/MAMP/htdocs/omeka-s/index.php(21): Laminas\Mvc\Application->run()

15 {main}

Next Laminas\Http\Client\Adapter\Exception\RuntimeException: Unable to enable crypto on TCP connection pactols.frantiq.fr: make sure the "sslcafile" or "sslcapath" option are properly set for the environment. in /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-http/src/Client/Adapter/Socket.php:350 Stack trace:

0 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-http/src/Client.php(1445): Laminas\Http\Client\Adapter\Socket->connect('pactols.frantiq...', 443, true)

1 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-http/src/Client.php(945): Laminas\Http\Client->doRequest(Object(Laminas\Uri\Http), 'GET', true, Array, '')

2 /Applications/MAMP/htdocs/omeka-s/modules/ValueSuggest/src/Suggester/Pactols/PactolsSujets.php(33): Laminas\Http\Client->send()

3 /Applications/MAMP/htdocs/omeka-s/modules/ValueSuggest/src/Controller/IndexController.php(58): ValueSuggest\Suggester\Pactols\PactolsSujets->getSuggestions('vase', 'fr')

4 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/Controller/AbstractActionController.php(77): ValueSuggest\Controller\IndexController->proxyAction()

5 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\Controller\AbstractActionController->onDispatch(Object(Laminas\Mvc\MvcEvent))

6 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))

7 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php(103): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))

8 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/DispatchListener.php(139): Laminas\Mvc\Controller\AbstractController->dispatch(Object(Laminas\Http\PhpEnvironment\Request), Object(Laminas\Http\PhpEnvironment\Response))

9 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\DispatchListener->onDispatch(Object(Laminas\Mvc\MvcEvent))

10 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))

11 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/Application.php(331): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))

12 /Applications/MAMP/htdocs/omeka-s/index.php(21): Laminas\Mvc\Application->run()

13 {main}

Omeka S version 3.0.2

2021-08-31T10:40:56+00:00 ERR (3): ErrorException: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-http/src/Client/Adapter/Socket.php:320 Stack trace:

0 [internal function]: Laminas\Stdlib\ErrorHandler::addError(2, 'stream_socket_e...', '/Applications/M...', 320, Array)

1 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-http/src/Client/Adapter/Socket.php(320): stream_socket_enable_crypto(Resource id #584, true, 57)

2 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-http/src/Client.php(1445): Laminas\Http\Client\Adapter\Socket->connect('pactols.frantiq...', 443, true)

3 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-http/src/Client.php(945): Laminas\Http\Client->doRequest(Object(Laminas\Uri\Http), 'GET', true, Array, '')

4 /Applications/MAMP/htdocs/omeka-s/modules/ValueSuggest/src/Suggester/Pactols/PactolsSujets.php(33): Laminas\Http\Client->send()

5 /Applications/MAMP/htdocs/omeka-s/modules/ValueSuggest/src/Controller/IndexController.php(58): ValueSuggest\Suggester\Pactols\PactolsSujets->getSuggestions('vase', 'fr')

6 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/Controller/AbstractActionController.php(77): ValueSuggest\Controller\IndexController->proxyAction()

7 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\Controller\AbstractActionController->onDispatch(Object(Laminas\Mvc\MvcEvent))

8 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))

9 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php(103): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))

10 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/DispatchListener.php(139): Laminas\Mvc\Controller\AbstractController->dispatch(Object(Laminas\Http\PhpEnvironment\Request), Object(Laminas\Http\PhpEnvironment\Response))

11 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\DispatchListener->onDispatch(Object(Laminas\Mvc\MvcEvent))

12 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))

13 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/Application.php(331): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))

14 /Applications/MAMP/htdocs/omeka-s/index.php(21): Laminas\Mvc\Application->run()

15 {main}

Next Laminas\Http\Client\Adapter\Exception\RuntimeException: Unable to enable crypto on TCP connection pactols.frantiq.fr: make sure the "sslcafile" or "sslcapath" option are properly set for the environment. in /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-http/src/Client/Adapter/Socket.php:350 Stack trace:

0 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-http/src/Client.php(1445): Laminas\Http\Client\Adapter\Socket->connect('pactols.frantiq...', 443, true)

1 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-http/src/Client.php(945): Laminas\Http\Client->doRequest(Object(Laminas\Uri\Http), 'GET', true, Array, '')

2 /Applications/MAMP/htdocs/omeka-s/modules/ValueSuggest/src/Suggester/Pactols/PactolsSujets.php(33): Laminas\Http\Client->send()

3 /Applications/MAMP/htdocs/omeka-s/modules/ValueSuggest/src/Controller/IndexController.php(58): ValueSuggest\Suggester\Pactols\PactolsSujets->getSuggestions('vase', 'fr')

4 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/Controller/AbstractActionController.php(77): ValueSuggest\Controller\IndexController->proxyAction()

5 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\Controller\AbstractActionController->onDispatch(Object(Laminas\Mvc\MvcEvent))

6 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))

7 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php(103): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))

8 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/DispatchListener.php(139): Laminas\Mvc\Controller\AbstractController->dispatch(Object(Laminas\Http\PhpEnvironment\Request), Object(Laminas\Http\PhpEnvironment\Response))

9 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\DispatchListener->onDispatch(Object(Laminas\Mvc\MvcEvent))

10 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))

11 /Applications/MAMP/htdocs/omeka-s/vendor/laminas/laminas-mvc/src/Application.php(331): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))

12 /Applications/MAMP/htdocs/omeka-s/index.php(21): Laminas\Mvc\Application->run()

13 {main}

jimsafley commented 3 years ago

If the module worked before and then stopped working, either your server environment has changed or both PACTOLS and Homosaurus switched to using SSL in the meantime. You'll probably need to configure Omeka's HTTP client to use your server's SSL certificate. Your server administrator should know where the certificate it.

miledrousset commented 3 years ago

Okay, thank you for this conclusion, so the problem needs to be resolved on our side, we have effectively switched to https. One last question before closing this thread, could you confirm that it works on your side the connection with PACTOLS and Homosaurus?

jimsafley commented 3 years ago

PACTOLS continues to work for me, but I have encountered a problem with Homosaurus (in my server environment, at least). It appears that the service is using weak SSL settings and Omeka's HTTP client is refusing to connect. This is probably something that Homosaurus should correct on their side, as we've never encountered this on another server.

I've made a temporary fix by including the following code in ValueSuggest\Suggester\Homosaurus\HomosaurusSuggest::__construct():

$adapter = $client->getAdapter();
$adapter->setStreamContext([
    'ssl' => [
        'ciphers' => 'DEFAULT@SECLEVEL=1',
    ],
]);

You could try this and see if it works, but note that you are getting a different error than I was. Your error:

OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed

My error (fixed by the code above):

OpenSSL Error messages: error:141A318A:SSL routines:tls_process_ske_dhe:dh key too small
miledrousset commented 3 years ago

Thank you for your answers and your availability, I will close the thread. I am not administering the Homosaurus server, I used it as an example which was not working. I only manage PACTOLS.

scande3 commented 3 years ago

@jimsafley @miledrousset -> Homosaurus has been made aware of this issue and I've created a new issue to track it at: https://github.com/DigitalTransgenderArchive/homosaurus_site/issues/6

We will update that location once we have resolved things hopefully in the next week or two regarding SSL certificate issues.