Wrong parameters for MeiliSearch\Exceptions\HTTPRequestException #37
Comments
Same issue here, after updating this package i needed to update this code example taken from the Readme like below => Book::search('prince', function (Index $meilisearch, $query, $options) {
$options['filters'] = 'author="Antoine de Saint-Exupéry"';
return $meilisearch->search($query, $options);
})->take(3)->get(); To Book::search('prince', function (Indexes $meilisearch, $query, $options) {
$options['filters'] = 'author="Antoine de Saint-Exupéry"';
return $meilisearch->search($query, $options);
})->take(3)->get(); See the And then i have this issue :
|
Hello guys! So sorry, the previous release should have been a new minor ( @YannickYayo, thanks for the fix! This PR #38 takes into account what you said! Is it enough for you or did I miss something? 🙂 @dmyers, does the fix of @YannickYayo solve your problem? |
@dmyers and @YannickYayo (and @shokme). Another question: do you think we should remove the |
Oh i forgot to to mention it, but my little fix doesn't solve the issue with In my opinion, creating a new |
Yeah I had already made the same change as @YannickYayo did with the typehint for the index and had this exception occur afterwards. Sorry accidentally closed by misclick mistake. Agree w/ @yannick on the versioning, but I don't really know much about semver or best practices on that stuff to be honest most of my packages are used just by me. 😄 |
Btw this won't simply be fixed with #38 because this exception is caused by a recent change from the upstream MeiliSearch PHP dependency that added compatibility with https://github.com/meilisearch/meilisearch-laravel-scout/releases/tag/v0.10.7 |
Update : I was using the |
Ok sorry guys, I went to fast, I understand my PR does not fix anything except a small part of the README 😅 So now @YannickYayo, I understand your problem is fixed, right? I've updated the README in #38 according to what you said: meilisearch-laravel-scout v0.10.7 is not compatible with MeiliSearch v0.12.0 and before @dmyers, I understand your issue is still there despite:
Right? |
@curquiza Yep, using Meilisearch |
I have been using the I'm still getting this error as of today, but it seems to be caused by the PHP SDK if my search server instance is down which is happening at random times and only solution is for me to restart it, but it still is not ideal that Meilisearch official PHP SDK doesn't handle proper exception status code for that case. I believe the root cause to be poor use of the Exception class extension in Here you can see the order of the args for Now look at the order of args for So now back to Laravel, somehow my MeiliSearch server freezes or something and this error floods my |
Oh sorry @dmyers, this issue shouldn't have been closed, my bad, it has been done automatically by GitHub because I linked the issue! Can you provide the part of the code that failed? Because it's currently complicated for us to guess what happened without details. I did not succeed to get your |
sometimes the body response is `null` and even if `null` looks like authorized it will throw this error: ```bash Error : Wrong parameters for MeiliSearch\Exceptions\HTTPRequestException([string $message [, long $code [, Throwable $previous = NULL]]]) .../meilisearch-php/src/Exceptions/HTTPRequestException.php:21 ``` by returning `$response->getReasonPhrase()` the error should not happen again ```php .... * @return string Reason phrase; must return an empty string if none present. */ public function getReasonPhrase(); ``` In my test case: using a wrong url -> http://localhost instead of http://localhost:7700 will return ```bash MeiliSearch\Exceptions\HTTPRequestException : Not Found .../meilisearch/meilisearch-php/src/Http/Client.php:183 ``` I guess this will also solve meilisearch/meilisearch-laravel-scout#37
@dmyers an update has been pushed, this should solved the "Wrong parameters". You must update the package to the version |
Thank you so much for the update @shokme. I was still seeing these exceptions in my failed jobs table in my Laravel app, but was finding it difficult to get a reproducible test case to share and so I'm glad you were able to solve it. I'll test out the new version shortly. |
Hello @dmyers, is this still an issue, can I close it? :) |
Started getting this exception after upgrading to the latest version yesterday of this package.
Stacktrace:
The text was updated successfully, but these errors were encountered: