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

Hitting a time out error 'Error: 500 - Request timed out.' but only client side #220

Open
eric-brace opened this issue Oct 8, 2024 · 5 comments

Comments

@eric-brace
Copy link

Description

Using typesense-instantsearch-adapter and for longer running queries getting a 500 timed out error after 5 seconds. It seems to match the timeout here int he advanced settings for algolia https://www.algolia.com/doc/api-reference/api-methods/configuring-timeouts/

For more context we're using Remix and don't have any timeouts set there. The response actually returns from the multi_search network call but the browser seems to cancel the request before it can be used by the application.

We're also using onStateChange in component. Wondering if there's a timeout setting somewhere that we've missed or if anyone has come across this before.

Typesense adapter configuration is set to 20 seconds.

server: {
      apiKey: ak,
      connectionTimeoutSeconds:20,
      nodes: [
        {
          host: '<host_url>',
          path:"/typesense",
          port: 443,
          protocol: 'https',
        },
      ],
    },

Steps to reproduce

Screenshot 2024-10-07 at 18 13 34 Screenshot 2024-10-07 at 18 13 59

Expected Behavior

Expect request to our typesense server to not timeout after 5 seconds. Using curl there's no timeout.

Actual Behavior

5 second timeout.

Metadata

Typesense Version:
"typesense-instantsearch-adapter": "^2.8.0"

OS:

@jasonbosco
Copy link
Member

Do you have a reverse proxy / backend that is proxying requests between the browser and Typesense? If so, I suspect that the timeout might be coming from that system.

In the adapter itself, connectionTimeoutSeconds is the only timeout configuration.

@eric-brace
Copy link
Author

eric-brace commented Oct 9, 2024

Is there a way to have the adapter limit the number of searches per multisearch call? Or to default to only doing one search?

@karolzdebel
Copy link

karolzdebel commented Nov 16, 2024

@jasonbosco I don't think it has to do with the reverse proxy since we can reproduce in a local environment where we're communicating directly with a local Typesense server. Some of the multi-search results return a 500 and an error message indicating a timeout. Other multi-search results part of the same request succeed.

I cannot reproduce when embeddings aren't being used. Could it be that the timeout stems from Typesense's network requests to Open AI or something else involving embeddings?

Note: I'm reproducing in Postman by sending multi-search requests "manually"

{
    "code": 500,
    "error": "Request timed out."
}

@jasonbosco
Copy link
Member

Ah with remote embedding, there is a separate timeout on the server side when making calls out to remote embedding services. These parameters are documented here: https://typesense.org/docs/27.1/api/vector-search.html#remote-embedding-api-parameters

The default is not 5s though, it's 30s.

@karolzdebel
Copy link

@jasonbosco Setting the remote_embedding_timeout_ms to 30s fixed the issue based on my testing so far. Can you verify the default is actually 30s and not 5s? Might be a bug in the docs or in the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants