karlomikus / vue-salt-rim

Salt Rim is a Vue based web client used for connecting to Bar Assistant server instance.
https://barassistant.app
MIT License
90 stars 17 forks source link

multi-search broken since the recent update #185

Open frank42hh opened 1 month ago

frank42hh commented 1 month ago

Hi,

I assume this comes from the recent update of the tag system (which is awesome!). But now the search bar in the upper right corner seems to be broken:

image

The dedicated search below the Cocktails and the Ingredients tab still works as expected. Unfortunately, the logfile doesn't give much information:

bar-assistant-meilisearch-1 | [2024-07-08T10:03:24Z INFO  actix_web::middleware::logger] 172.22.0.1 "POST /multi-search HTTP/1.0" 200 6788 "https://core.einhorn.bar/cocktails" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" 0.003851
bar-assistant-meilisearch-1 | [2024-07-08T10:03:24Z INFO  actix_web::middleware::logger] 172.22.0.1 "POST /multi-search HTTP/1.0" 400 456 "https://core.einhorn.bar/cocktails" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" 0.000658
zhdenny commented 1 month ago

Works for me. Have you tried clearing cache/cookies?

frank42hh commented 1 month ago

Been there, done that, even tried in a chrome incognito window with no cache/cookies present. Still "error 400" in the logfile and the mentioned display above. Also, the same on smartphone and bartender tablet.

karlomikus commented 1 month ago

Hello, can you check for errors in the browser console.

New tag search doesn't use meilisearch so it shouldn't be related to that.

OFlannigan commented 1 month ago

Hi,

I'm experiencing the same issue as @frank42hh. When I open the search on the top right, the browser console has the following output:

POST https://core.einhorn.bar/search/multi-search 400 (Bad Request)
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:3
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:3
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:1
a @ instant-meilisearch.esm-a8c3febb.js:1
fetchWithTimeout @ instant-meilisearch.esm-a8c3febb.js:3
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:3
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:1
a @ instant-meilisearch.esm-a8c3febb.js:1
request @ instant-meilisearch.esm-a8c3febb.js:3
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:3
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:1
a @ instant-meilisearch.esm-a8c3febb.js:1
post @ instant-meilisearch.esm-a8c3febb.js:3
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:3
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:1
a @ instant-meilisearch.esm-a8c3febb.js:1
multiSearch @ instant-meilisearch.esm-a8c3febb.js:3
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:4
h @ instant-meilisearch.esm-a8c3febb.js:4
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:4
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:4
F @ instant-meilisearch.esm-a8c3febb.js:4
multiSearch @ instant-meilisearch.esm-a8c3febb.js:4
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:4
h @ instant-meilisearch.esm-a8c3febb.js:4
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:4
d @ instant-meilisearch.esm-a8c3febb.js:4
Promise.then
o @ instant-meilisearch.esm-a8c3febb.js:4
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:4
F @ instant-meilisearch.esm-a8c3febb.js:4
search @ instant-meilisearch.esm-a8c3febb.js:4
ce._search @ index-7584ce78.js:74
ce.searchOnlyWithDerivedHelpers @ index-7584ce78.js:74
s.search @ index-7584ce78.js:89
(anonymous) @ index-7584ce78.js:89
(anonymous) @ index-7584ce78.js:53
Promise.then
n @ index-7584ce78.js:53
value @ index-7584ce78.js:89
(anonymous) @ index-7584ce78.js:101
Promise.then
Pa @ index-7584ce78.js:13
mounted @ index-7584ce78.js:101
(anonymous) @ index-7584ce78.js:13
Hr @ index-7584ce78.js:13
Yt @ index-7584ce78.js:13
t.__weh.t.__weh @ index-7584ce78.js:13
_o @ index-7584ce78.js:13
Vh @ index-7584ce78.js:13
Promise.then
Wh @ index-7584ce78.js:13
Xo @ index-7584ce78.js:13
(anonymous) @ index-7584ce78.js:13
Tu @ index-7584ce78.js:9
Nr @ index-7584ce78.js:9
set @ index-7584ce78.js:9
(anonymous) @ AuthLayout-90124203.js:1
Ze.r.<computed>.r.<computed> @ index-7584ce78.js:17
Hr @ index-7584ce78.js:13
Yt @ index-7584ce78.js:13
r @ index-7584ce78.js:17
MeiliSearchApiError: Unknown field `attributesToSearchOn` inside `.queries[0]`: expected one of `indexUid`, `q`, `offset`, `limit`, `page`, `hitsPerPage`, `attributesToRetrieve`, `attributesToCrop`, `cropLength`, `attributesToHighlight`, `showMatchesPosition`, `filter`, `sort`, `facets`, `highlightPreTag`, `highlightPostTag`, `cropMarker`, `matchingStrategy`
    at instant-meilisearch.esm-a8c3febb.js:1:7412
    at Generator.next (<anonymous>)
    at d (instant-meilisearch.esm-a8c3febb.js:1:6152)
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:4
h @ instant-meilisearch.esm-a8c3febb.js:4
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:4
h @ instant-meilisearch.esm-a8c3febb.js:4
Promise.then
o @ instant-meilisearch.esm-a8c3febb.js:4
d @ instant-meilisearch.esm-a8c3febb.js:4
Promise.then
o @ instant-meilisearch.esm-a8c3febb.js:4
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:4
F @ instant-meilisearch.esm-a8c3febb.js:4
search @ instant-meilisearch.esm-a8c3febb.js:4
ce._search @ index-7584ce78.js:74
ce.searchOnlyWithDerivedHelpers @ index-7584ce78.js:74
s.search @ index-7584ce78.js:89
(anonymous) @ index-7584ce78.js:89
(anonymous) @ index-7584ce78.js:53
Promise.then
n @ index-7584ce78.js:53
value @ index-7584ce78.js:89
(anonymous) @ index-7584ce78.js:101
Promise.then
Pa @ index-7584ce78.js:13
mounted @ index-7584ce78.js:101
(anonymous) @ index-7584ce78.js:13
Hr @ index-7584ce78.js:13
Yt @ index-7584ce78.js:13
t.__weh.t.__weh @ index-7584ce78.js:13
_o @ index-7584ce78.js:13
Vh @ index-7584ce78.js:13
Promise.then
Wh @ index-7584ce78.js:13
Xo @ index-7584ce78.js:13
(anonymous) @ index-7584ce78.js:13
Tu @ index-7584ce78.js:9
Nr @ index-7584ce78.js:9
set @ index-7584ce78.js:9
(anonymous) @ AuthLayout-90124203.js:1
Ze.r.<computed>.r.<computed> @ index-7584ce78.js:17
Hr @ index-7584ce78.js:13
Yt @ index-7584ce78.js:13
r @ index-7584ce78.js:17
Uncaught (in promise) Error: MeiliSearchApiError: Unknown field `attributesToSearchOn` inside `.queries[0]`: expected one of `indexUid`, `q`, `offset`, `limit`, `page`, `hitsPerPage`, `attributesToRetrieve`, `attributesToCrop`, `cropLength`, `attributesToHighlight`, `showMatchesPosition`, `filter`, `sort`, `facets`, `highlightPreTag`, `highlightPostTag`, `cropMarker`, `matchingStrategy`
    at Proxy.<anonymous> (instant-meilisearch.esm-a8c3febb.js:4:14802)
    at h (instant-meilisearch.esm-a8c3febb.js:4:3626)
    at Object.throw (instant-meilisearch.esm-a8c3febb.js:4:2909)
    at h (instant-meilisearch.esm-a8c3febb.js:4:2540)
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:4
h @ instant-meilisearch.esm-a8c3febb.js:4
(anonymous) @ instant-meilisearch.esm-a8c3febb.js:4
h @ instant-meilisearch.esm-a8c3febb.js:4
Promise.catch
ce._search @ index-7584ce78.js:74
ce.searchOnlyWithDerivedHelpers @ index-7584ce78.js:74
s.search @ index-7584ce78.js:89
(anonymous) @ index-7584ce78.js:89
(anonymous) @ index-7584ce78.js:53
Promise.then
n @ index-7584ce78.js:53
value @ index-7584ce78.js:89
(anonymous) @ index-7584ce78.js:101
Promise.then
Pa @ index-7584ce78.js:13
mounted @ index-7584ce78.js:101
(anonymous) @ index-7584ce78.js:13
Hr @ index-7584ce78.js:13
Yt @ index-7584ce78.js:13
t.__weh.t.__weh @ index-7584ce78.js:13
_o @ index-7584ce78.js:13
Vh @ index-7584ce78.js:13
Promise.then
Wh @ index-7584ce78.js:13
Xo @ index-7584ce78.js:13
(anonymous) @ index-7584ce78.js:13
Tu @ index-7584ce78.js:9
Nr @ index-7584ce78.js:9
set @ index-7584ce78.js:9
(anonymous) @ AuthLayout-90124203.js:1
Ze.r.<computed>.r.<computed> @ index-7584ce78.js:17
Hr @ index-7584ce78.js:13
Yt @ index-7584ce78.js:13
r @ index-7584ce78.js:17

Running Salt Rim v 2.15.0, Bar Assistant v 3.17.0 and Mellisearch 1.1.1

karlomikus commented 1 month ago

It's a pretty old meilisearch version so I'm guessing its probably related to that. You could try updating to a newer one like 1.8

frank42hh commented 1 month ago

It's a pretty old meilisearch version

Yep, I know... it's still from the first release of the docker-compose image which I'm using. I'm not very experienced with docker yet, so I might or might not have sufficient practice to do that. I already attempted to upgrade meilisearch before, but that went rogue - I didn't save error logs from that but the upgrade howto from the meilisearch homepage didn't work and restarting it with a clean database didn't work either, so I reverted back to the snapshot again. I'll try again next week and will try to report more detailed.

frank42hh commented 1 month ago

Hi again, sorry to ask stupid docker questions, but as said, I'm not yet experienced enough to get alle the details of running something in a container ;-)

I managed to delete the meilisearch volume and recreated it with meilisearch:v1.8 now. The container starts up everything as expected, and the logfile says (amongst other things) this:

bar-assistant-meilisearch-1    | 2024-07-30T13:44:28.590872Z  INFO index_scheduler::batch: document indexing done indexing_result=DocumentAdditionResult { indexed_documents: 231, number_of_documents: 231 }

bar-assistant-meilisearch-1    | 2024-07-30T13:44:28.598748Z  INFO index_scheduler: A batch of tasks was successfully completed with 1 successful tasks and 0 failed tasks.

I think this means that meilisearch is running, but then, when I try to open the multi-search, I still get an error, but another one:

bar-assistant-meilisearch-1    | 2024-07-30T13:45:46.450343Z  WARN HTTP request{method=POST host="127.0.0.1:7700" route=/multi-search query_parameters= user_agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 status_code=403 error=The provided API key is invalid.}: tracing_actix_web::middleware: Error encountered while processing the incoming HTTP request: ResponseError { code: 403, message: "The provided API key is invalid.", error_code: "invalid_api_key", error_type: "auth", error_link: "https://docs.meilisearch.com/errors#invalid_api_key" }
bar-assistant-meilisearch-1    | 2024-07-30T13:45:46.452109Z  INFO HTTP request{method=POST host="127.0.0.1:7700" route=/multi-search query_parameters= user_agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 status_code=403 error=The provided API key is invalid.}: meilisearch: close time.busy=1.23ms time.idle=2.60ms

I only changed the meilisearch version, I didn't touch the MEILI_MASTER_KEY entry in .env or the MEILISEARCH_KEY entries in the docker-compose file, so I'm quite clueless where to search for the origin of this error.

A query against meilisearch from commandline works fine as well:

# curl -X GET 'http://localhost:7700/indexes' -H 'Authorization: Bearer <heres_my_master_key>'

{"results":[{"uid":"cocktails","createdAt":"2024-07-30T13:22:36.602925352Z","updatedAt":"2024-07-30T13:44:27.971867251Z","primaryKey":"id"},{"uid":"ingredients","createdAt":"2024-07-30T13:22:36.629758866Z","updatedAt":"2024-07-30T13:44:28.585761937Z","primaryKey":"id"}],"offset":0,"limit":20,"total":2}

So what did I break this time?

frank42hh commented 1 month ago

Update: I just happened to notice that after removing the cache data of the site, the search works again. Is it possible that the API connection to meilisearch is somehow cached on client side? Sorry for the confusion but I honestly didn't think of the possibility that something that is cached in the browser would survive a shift-reload. On a side note: while the search itself is working again, the thumbnail images of the recipes are not displayed within the search results. Does someone happen to have an idea about that?

image

karlomikus commented 1 month ago

API keys are saved per bar, clearing the cache or re-selecting bar usually helps.

Missing thumbnails should have some errors in network logs, or in API container logs.

What you can try is docker compose exec bar-assistant php artisan bar:refresh-search --clear and see if it helps.

frank42hh commented 1 month ago

Hi, thanks for the hint, but that didn't solve the problem.

According to the Developer Tools Console, this happens:

AuthLayout-90124203.js:1 Mixed Content: The page at 'https://core.einhorn.bar/' was loaded over HTTPS, but requested an insecure element 'http://localhost/bar/api/images/125/thumb'. This request was automatically upgraded to HTTPS, For more information see https://blog.chromium.org/2019/10/no-more-mixed-messages-about-https.html

and

GET http://localhost/bar/api/images/127/thumb net::ERR_CONNECTION_REFUSED

I have no idea why it seems to request the cocktail thumbnails over http://localhost/ - the correct URL should be https://core.einhorn.bar/bar/api/images/125/thumb , which works.

(and yes, this time I remembered to clean my browser cache before testing :-))

karlomikus commented 1 month ago

That's weird, how does your .env look, seems like maybe APP_URL is wrongly set up