Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite Page Loading Next.js when no connection to search server #6525

Open
1 task done
dwin0 opened this issue Jan 13, 2025 · 1 comment
Open
1 task done

Infinite Page Loading Next.js when no connection to search server #6525

dwin0 opened this issue Jan 13, 2025 · 1 comment
Labels
triage Issues to be categorized by the team

Comments

@dwin0
Copy link

dwin0 commented Jan 13, 2025

🐛 Current behavior

Next.js version: 15.0.4

I'm using InstantSearchNext together with Typesense (typesense-instantsearch-adapter). Everything works fine, except when there's no connection to the self hosted Typesense server. In this case, the following things happen:

  • Server side: A huge nested stack trace is displayed with this content:
    constructor: [Function: AxiosError] { from: [Function (anonymous)] },
    toJSON: [Function: toJSON],
    [AggregateError: ] { code: 'ECONNREFUSED' }
    
  • Client side: Infinite loading screen.

Yes, this is problem is more relevant for self hosted search servers, but I would expect this behaviour to appear as well when there's a connection problem with Algolia.

🔍 Steps to reproduce

  1. Install InstantSearchNext
  2. Point the search client to a non-existing URL
  3. Open the page with SSR enabled

I tried to replicate the local setup on codesandbox, but I see a different error there.

Live reproduction

https://codesandbox.io/p/devbox/nifty-snowflake-fgxqcg?file=%2Fcomponents%2Fsearch.tsx%3A5%2C9-5%2C21

💭 Expected behavior

I would expect to see the Next.js error component being sent to the browser.

Could it be that the error is not bubbled up correctly? Or it's bubbled up, but some code is not reacting to it? I looked into this code a bit and was wondering if the reason is that the promise only resolved on "result": once('result'
https://github.com/algolia/instantsearch/blob/master/packages/react-instantsearch-nextjs/src/InitializePromise.tsx

I found this previous issue that sounds related to the current problem. The solution at that time was to adjust the error propagation logic: #5233

Thanks for any support on this issue!

Package version

react-instantsearch-nextjs@0.3.20 react-instantsearch@7.13.9 typesense-instantsearch-adapter@2.8.0

Operating system

maxOS 15.2

Browser

Chrome 131

Code of Conduct

  • I agree to follow this project's Code of Conduct
@dwin0 dwin0 added the triage Issues to be categorized by the team label Jan 13, 2025
@Haroenv
Copy link
Contributor

Haroenv commented Jan 13, 2025

This is not a realistic use case as Algolia has a robust SLA, so an edge case happening while there's no network connection is so rare it won't happen in real life. You can likely catch the error in your adapter and work that way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Issues to be categorized by the team
Projects
None yet
Development

No branches or pull requests

2 participants