algoliasearch-client-javascript: AlgoliaSearchNetworkError without more information is thrown when appId or apiKey is wrong

Hey guys, awesome work with this JS client. I’m having an issue using this in React Native.

What is the current behavior? Currently, It presents me with an AlgoliaSearchNetworkError. I have gone through the code, looked at the hn react native sample app and still, I’m unable to move past the error.

Here is a JSBin of my code and a screenshot of the error screen shot 2017-08-24 at 9 30 04 pm

Versions “algoliasearch”: “^3.24.3”, “react”: “16.0.0-alpha.12”, “react-native”: “0.46.4”

Any help would be appreciated. Thanks If you need any more info from me, please let me know

PS: I have also had a look at this issue but it doesn’t help

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18 (7 by maintainers)

Most upvoted comments

The reason is that the appid is actually used to create the $appid-dsn.algolia.net domain name to call. So when the appid is bad we are basically trying to resolve a dns that does not exists. Thus the very generic error message, I wonder if it’s possible nowadays to distinguish a wrong DNS resolution from a regular no network issue.

When you do not have network, you cannot resolve, but unsure you can make the distinction.

We could still on those network errors put some more details in the message

I’m getting the same issue with IS for JavaScript. If you use wrong credentials, you’re getting a AlgoliaSearchNetworkError.

Demo: https://codepen.io/anon/pen/YjVKKp?editors=0010 (use the browser console)

capture d ecran 2018-07-24 a 11 28 11

Phew! I’ve been able to fix this issue. For anyone else having the same issue as me, double check your application ID and API Key.

This could have been avoided if the error message was clearer about where the error was. i.e. with the application credentials. This cost me two painful days of work, and i would hate to see anybody else go through a similar thing. Is there a way to do this check?. I can work on a PR for this.