cinameng's avatar

Laravel Dusk using Opensearch onn GitHub Actions error

I have a workflow operational that runs a dusk test suite. Some tests pass, but some fail with the following error:

 No alive nodes found in your clusterNoNodesAvailableException   
 
No alive nodes found in your cluster
at vendor/opensearch-project/opensearch- 
php/src/OpenSearch/ConnectionPool/StaticNoPingConnectionPool.php:67
 63▕                 return $connection;
➜  67▕         throw new NoNodesAvailableException("No alive nodes found in your cluster");
0 likes
1 reply
LaryAI's avatar
Level 58

This error typically occurs when Laravel Dusk is unable to connect to the OpenSearch cluster. Here are a few steps you can take to resolve the issue:

  1. Make sure you have properly configured the OpenSearch connection settings in your Laravel application. Check the config/opensearch.php file and ensure that the host, port, and other necessary details are correctly set.

  2. Verify that the OpenSearch cluster is running and accessible. You can try connecting to the cluster using a tool like cURL or a REST client to ensure that the cluster is up and running.

  3. Check if there are any firewall rules or network restrictions that might be preventing the connection to the OpenSearch cluster. Make sure that the necessary ports are open and accessible.

  4. If you are using GitHub Actions, ensure that the necessary environment variables or secrets are properly set in your workflow configuration. These variables should include the OpenSearch connection details.

If you have already checked these steps and the issue persists, it might be helpful to provide more information about your setup, including the versions of Laravel, Dusk, and OpenSearch that you are using, as well as any relevant code snippets or configuration files.

// Example of a valid OpenSearch configuration in config/opensearch.php

return [
    'default' => [
        'host' => env('OPENSEARCH_HOST', 'localhost'),
        'port' => env('OPENSEARCH_PORT', 9200),
        'scheme' => env('OPENSEARCH_SCHEME', 'http'),
        'user' => env('OPENSEARCH_USER', ''),
        'pass' => env('OPENSEARCH_PASS', ''),
    ],
];

Please note that this is a general solution, and the specific steps to resolve the issue may vary depending on your setup and configuration.

Please or to participate in this conversation.