17

I've been experiencing some empty page results ramdomly these last few weeks (maybe since the last update?). I tried to capture more information this time:

These two requests are generated on every click of the search button (the magnifying glass icon) or pressing the key ENTER to search for the query. The webpage stays empty when it happens (the only thing that changes is the "Results in Xs").

It I reload the tab in my browser everything comes back to normal, which makes me bet on a UI bug.

US-EAST
Firefox 104

    Thanks for reporting. Is anyone else seeing these?

      Steps to reproduce:
      <Include steps to reproduce the bug.>

      • Search 'amd' -> see results
      • update search 'amd Ryzen' -> blank page
      • submit a second time and still blank page.
      • Refreshed page and got results.

      Can't reliably reproduce. It could just be an unstable connection or some js error, this report is probably not actionable but I figured it's better to notify that it happened.

      Expected behavior:
      Search results should appear. If there was a network issue it would be good to see an error message.

      Debug info:
      <Browser/OS/Active Kagi region setting/What Kagi server you connect to (found in control center, top right icon)>
      Firefox nightly, android 12 (lineage os). Europe-west-2. I noticed 900ms latency when I checked
      Image/Video:
      <Copy/paste or drag and drop to upload images or videos (up to 20MB)>

      • Vlad replied to this.

        hitch Yeah this is difficult to reproduce. We used to have these blank pages in the past, but the issue hasn;'t surfaced in a while. @z64 any ideas?

          6 days later
          Merged 2 posts from Blank page after updating results .

            Yes, I experience this issue occasionally as well. I know no way to reproduce. Almost seems random. Tells me it's either a network error or a race condition. I also found that sometimes page refreshes fail to resolve the issue on first attempt. I have to manually refresh the page multiple times to finally get a result.

              10 days later

              Happened when I visited reddit, then hit back on my browser's back button.

              • Vlad replied to this.

                EPVMDLSU So initial search was not empty? The search you performed going back from reddit was then empty?

                  Vlad correct. The initial search returned results just fine. The issue occurred when I clicked on a result that takes me to reddit and I click on my browser's back button. I am then presented with an empty result.

                  • Vlad replied to this.

                    EPVMDLSU Oh ok so when you got back the page results that were there previously, were gone? You did not search and get empty results?

                      Vlad when I hit refresh, nothing appears. It remains empty. I have to open a new tab to be able to search again.

                        I'll be sure to capture a recording for you the next time I encounter this.

                          Ok so it seems our FE rendering code broke on you going back from an opened result. What browser/OS is this? and can you reproduce it by doing the same thing?

                            I am using FireFox 104.0.2 (64-bit) on MacOS 11.6.8.

                            I am unable to reproduce the issue, even when replicating my same steps.

                              8 days later

                              @Vlad . I have encountered the issue again. This time with a screen recording.

                              I am available to jump on a video call and share my screen live if you think that'll help you debug. I'll leave the tab open for now.

                                Shoot. As you saw, no matter how many times I refresh the page, it would never return results. So I decided to open a new tab and made the same query. I got a result. When I go back to the original tab and hit refresh, well, what do you know, I get results. So sorry, I lost the tab for us to debug live.

                                  a month later

                                  I got this again recently but with my desktop. I was investigating it a bit and writing some info here but got distracted by work and forgot about it 😅 So I'm working from memory here. Looking back at the reports I guess it might be a different issue since I didn't get a blank page after..

                                  When I got the issue I had some errors in the console. First I checked the response to make sure it looks OK:

                                  I ran a diff on the html from a working page, and it was identical aside from the Nonce and a URL parameter (a token maybe?) being different, so looked good. Same thing with the autosuggestions, they looked identical.

                                  I had some console errors

                                  Interesting, "can't access dead object" is something I never came across before, sounds something like a GC cleaning up a reference to something held in memory...

                                  Found this page on it:
                                  https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Dead_object

                                  The JavaScript exception "can't access dead object" occurs when Firefox disallows add-ons to keep strong references to DOM objects after their parent document has been destroyed to improve in memory usage and to prevent memory leaks.

                                  This also explains why all examples here are in Firefox..

                                  The interesting thing is that the article specifies that addons cannot hold a strong reference between documents, it initially made me think that the error is caused by some addon interaction. but the error does originate from Kagi's JS

                                  I can't remember the exact line that triggered the error, but I think it was one of these for auto suggestions:

                                        leadSvgUse.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', svgId),
                                        leadSvg.appendChild(leadSvgUse),
                                        leadSvg.appendChild(leadSvgUse),

                                  I ended up remembering to come here because I just encountered the blank-page issue. In this case I'm getting results from kagi.com/stream/ instead, seems like a different method to what I saw when I was debugging last time. No console errors but will look into it a little and see if I can find something

                                  Ok. It seems Kagi loads different JS files based on the context you load the page. If you load kagi.com you'll get
                                  k_lan.min.js
                                  . In this context search is submitted by navigating to /search with the search string.

                                  When you load /search (either by the main page, or by browser address bar) you'll load k_sea.min.js. This seems to load results from a websocket by sending events to the page.

                                  If you click the button to switch to a lens, you instead get k_len.min.js.
                                  (I'm interpreting the naming here as kagi_landing, kagi_search, kagi_lense)

                                  Firstly, the browser reports a content-security violation Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). k_len.min.js:1580 (The resulting report request was blocked by ublock, so perhaps you didn't get notified of this before. I disabled ublock and reloaded the page a few times just in case 😉)
                                  After that no console errors occur

                                  But I noticed that k_len.min.js does not have an event listener for the "provider:search" event. (And the html from the socket does not seem to either) It seems to respond to other events, for example 'provider:top_search' will update, even showing me a correction for misspellings.

                                  Here are the event listeners for provider:search

                                  window.addEventListener('provider:search', (() =>{
                                    const instantTab = document.querySelector('.instant-tab');
                                    instantTab && (instantTab.hidden = !0)
                                  })),
                                  [
                                    'provider:search',
                                    'provider:lenses',
                                    'provider:news',
                                    'provider:videos',
                                    'provider:images'
                                  ].forEach((typ=>{
                                    window.addEventListener(typ, (() =>{
                                      metric.timeAction('setup_highlight', setupResults)
                                    }))
                                  })),

                                  And so nothing happens, the content of the page gets cleared.

                                  I can reproduce this 100% consistently, either navigating directly to a search with &l=4 in the uri (any lens will work) or by toggling the button after a normal search. A second search will do nothing, and a third search will clear the results.

                                  Also reproduced on chromium with no extensions