solomon mulatu
08/11/2025, 11:23 AMTypesenseInstantSearchAdapter
setup in React Native fail to connect, even though raw Axios calls to the same Railway-hosted Typesense endpoint succeed? I'm passing the correct hostname and API key, using port 8080 and protocol 'https'. Could it be an adapter limitation in mobile environments, or is there a mismatch in how the host or connection settings are parsed?
import TypesenseInstantSearchAdapter from 'typesense-instantsearch-adapter';
import config from '@/utils/config';
const createTypesenseAdapter = (lat: number, lng: number, radius = '30km') => {
console.log("lat is" + lat + " lng is" + lng + " radius is" + radius);
console.log("config is" + JSON.stringify(config, null, 2));
return new TypesenseInstantSearchAdapter({
server: {
apiKey: apikey,
nodes: [
{
host: 'typesense-production-uytfg.up.railway.app',
port: 8080,
protocol: 'https'
}
],
timeoutSeconds: 50
}
,
additionalSearchParameters: {
query_by: [
'name_en',
'name_am',
'description_en',
'description_am',
'address',
'services.name_en',
'services.name_am',
'services.description_en',
'services.description_am',
],
// Dynamically add location filter
filter_by: lat && lng ? location:([${lat}, ${lng}], radius: ${radius})
: '',
sort_by: lat && lng ? location(${lat}, ${lng}):asc
: 'name_en:asc',
},
})
};
export default createTypesenseAdapter;