Laravel+Algolia Development to Production search not working

Hi there,
I discovered Algolia few months ago and it is awesome.
I have started implementing Algolia with Laravel Scout during the Development phase (locally) of my platform, and everything worked fine. Indexing was working perfectly and so was the search system on my platform.
But today I made a test-Deploy (online) and something broke out. The weird this is, from my Algolia Dashboard I see that the index updates are working perfectly, but from my deployed website they cannot be found with search.
Am I missing something there?
I am using the same Application ID and the same Admin API Key I was using during the development phase.
Also, the index is the same.

So I tried creating a new Application in Algolia, and updating the API Keys. But as soon as I try to import my table in Algolia (in laravel you type php artisan scout:import “App\TableName”), I get an error:

Hosts unreachable: Could not resolve host:,Could not resolve host:,Could not resolve host:,Could not resolve host:

I would really appreciate any help to solve the problem.

This error typically happen when the APP_ID is incorrect. Can you check your credential one more time? Make sure you are modifying the .env file and that it’s correctly take into account.

If you want to use the same application, you can define different SCOUT_PREFIX. It will prefix each index.

Hi julien.
I’ve tried both with the same APP ID and with another APP ID I’ve created, but no way. The APP IDs are correct, I’ve checked one thousand times.
I’ve also tried the prefix approach.
It just doesn’t seem to synchronize the Algolia index with my app database.
Could it be because I am using a hosting provider and not my own physical server?
This is the last thing to fix before I can deploy my platform and my brain hurts.

From your server, can you ping ?

Uhm. I tried.
It gives me the following error:
ping: icmp open socket: Operation not permitted.
So I guess it’s my problem?

It might be, you can try with curl or wget. Maybe you simply don’t have access to ping.

Hello I’m not a expert but in my case in the file scout.php was look like that ‘prefix’ => env(‘SCOUT_PREFIX’, ‘’) and I change to ‘prefix’ => ‘index’

this works to me I holpe help you

I have face same problem is that algolia is working fine in my local system with laravel and when i deployed to production server its not working. checked and getting out, same cred using in but not getting issue on production server.

there are another scenario on production server. if i change cred in env by the wrong cred then it is not giving me error on production but this is same case i applied on local system give instant error.

1 Like