meilisearch-php: Unknown parameter `primaryKey`: expected one of `offset`, `limit`, `fields`
Description I am using Laravel Sail (Docker) and my unit tests are suddenly failing. I’m not yet sure where the problem exactly lies.
Failed to connect to 127.0.0.1 port 7700 after 0 ms: Connection refused for “http://127.0.0.1:7700/indexes/MY_INDEXES/documents?primaryKey=id”.
Opening the link gives the following JSON:
{
"message": "Unknown parameter `primaryKey`: expected one of `offset`, `limit`, `fields`",
"code": "bad_request",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#bad_request"
}
Environment
- OS: macOS
- PHP v8.2.3
- Laravel v10.1.5
- Laravel Sail v1.21.0
- Laravel Scout v9.8.1
- Meilisearch Docker image v1.0.2
- meilisearch-php version: ^1.0
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 18 (9 by maintainers)
What could have happened in your case was that you were running two instances of meilisearch (one with docker) and another directly in your host. Meilisearch does not handle accesses differently for Meili, and it does not matter if you’re calling localhost, over the wire, or using an SDK.
This used to happen to me because I switch SDK environments 10x a day, so it was common to have this mismatch and, consequently, some weird behavior.
What I would like to have in the SDKs was a way to verify which meili version the developer is running and alert them if it was not the expected one.
Unfortunately, I couldn’t reproduce this behavior either, so we may need to wait for someone else with the same issue. Unless, of course, you find a new tip.
Take care!
I don’t use it, unless Scout uses it under the hood.
Perhaps I’ll try reproducing it later with a fresh Laravel installation. Maybe that would narrow down the problem further.
Manually changing
^9.8
to^10.0
incomposer.json
worked to upgrade:Although some other issues are solved (e.g.
artisan scout:delete-all-indexes
), I’m still getting the same problem as described at the beginning.