CloudCannon / pagefind

Static low-bandwidth search at scale
https://pagefind.app
MIT License
3.22k stars 97 forks source link

Runtime error "unreachable executed" when search term contains emoticon #621

Open micmath opened 1 month ago

micmath commented 1 month ago

When the search term contains the dog face emoticon 🐶 (and every other emoticon I tried), the following error is shown in the browser console:

Uncaught (in promise) RuntimeError: unreachable executed
    request_indexes https://pagefind.app/_pagefind/pagefind.js:1
    search https://pagefind.app/_pagefind/pagefind.js:9
    preload https://pagefind.app/_pagefind/pagefind.js:9
    preload https://pagefind.app/_pagefind/pagefind.js:12
    preload https://pagefind.app/_pagefind/pagefind.js:12
    Ne https://pagefind.app/_pagefind/pagefind.js:12
    Ca https://pagefind.app/_pagefind/pagefind-ui.js?_cchid=85673e7d162d4c9ffdb4a7d92d21aa44:2
    update https://pagefind.app/_pagefind/pagefind-ui.js?_cchid=85673e7d162d4c9ffdb4a7d92d21aa44:2
    Ps https://pagefind.app/_pagefind/pagefind-ui.js?_cchid=85673e7d162d4c9ffdb4a7d92d21aa44:1
    we https://pagefind.app/_pagefind/pagefind-ui.js?_cchid=85673e7d162d4c9ffdb4a7d92d21aa44:1
    promise callback*Is https://pagefind.app/_pagefind/pagefind-ui.js?_cchid=85673e7d162d4c9ffdb4a7d92d21aa44:1
    Js https://pagefind.app/_pagefind/pagefind-ui.js?_cchid=85673e7d162d4c9ffdb4a7d92d21aa44:1
    ctx https://pagefind.app/_pagefind/pagefind-ui.js?_cchid=85673e7d162d4c9ffdb4a7d92d21aa44:1
    Ba https://pagefind.app/_pagefind/pagefind-ui.js?_cchid=85673e7d162d4c9ffdb4a7d92d21aa44:2
[pagefind.js line 1 > WebAssembly.instantiate:103122:1](https://pagefind.app/_pagefind/pagefind.js%20line%201%20%3E%20WebAssembly.instantiate)

This can be reproduced by going to the https://pagefind.app/ website and entering any search string that contains an emoticon, then examining the Web Inspector console.

Possibly useful? https://rustwasm.github.io/docs/book/reference/debugging.html#logging-panics

bglw commented 1 month ago

Ah, good find! We do have a few emoji tests in our suite, but they only have the emoji within a sentence (which works) rather than on its own (which does not). This has worked in the past so it shouldn't be a hard fix. Will fix 🙂

(NB: Pagefind does have a debug build with better panic logging, but the production WebAssembly doesn't have that compiled in to save on some bytes)