KARTHICK RAJA
05/19/2023, 12:58 PMbrew install typesense/tap/typesense-server@0.24.1
• And i have started the service using
brew services start typesense-server@0.24.1
• I started to hit this API <http://localhost:8108/health>
• I got the status { ok: true }
• But when i try to hit the Typesense health check from my BE it's showing the below error This is happening in now before its working fine in another Mac.Kishore Nallan
05/19/2023, 1:04 PMSergio Behrends
05/19/2023, 4:10 PM127.0.0.1
as address instead of localhost
or your LAN IP. It could be related to the BE running in an isolated network (like docker)KARTHICK RAJA
05/21/2023, 5:01 PMKARTHICK RAJA
05/21/2023, 5:03 PMKARTHICK RAJA
05/21/2023, 5:06 PM<http://localhost:8108/health>
• From the above health check i'm getting {ok : true}.
• When i try to connect from my BE its throwing error.
• In my older Mac its working fine i have followed the same setup procedure i'm getting error now.Jason Bosco
05/21/2023, 6:04 PMKARTHICK RAJA
05/22/2023, 4:29 AMJason Bosco
05/22/2023, 5:31 PMKARTHICK RAJA
05/23/2023, 5:35 AMconst configTypesense: any =
process.env.NODE_ENV === 'development'
? {
host: typesenseHost,
port: Number(typesensePort),
protocol: typesenseProtocol,
}
:
{
host: typesenseHost,
protocol: typesenseProtocol,
};
const client = new Typesense.Client({
nodes: [configTypesense],
apiKey:typesenseApiKey,
connectionTimeoutSeconds: 60,
});
• This is the env:
### TYPESENSE
TYPESENSE_HOST=localhost
TYPESENSE_PORT=8108
TYPESENSE_PROTOCOL=http
TYPESENSE_APIKEY=xyz
KARTHICK RAJA
05/23/2023, 5:38 AMtypesenseRouter.get('/health/check', healthCheck);
• This is the controller:
export const healthCheck = async (
_req: Request,
res: Response,
next: NextFunction
): Promise<void> => {
try {
const checkStatus = await typesenseHealthCheck();
res.status(200).json({
response: 'success',
message: 'typesense server running successfully',
data: checkStatus,
});
} catch (error) {
next(BadRequest('Failed to run the typesense', error));
}
};
• This is the services :
export const typesenseHealthCheck = async (): Promise<HealthResponse> => {
const health = await client.health.retrieve();
return health;
};
KARTHICK RAJA
05/24/2023, 1:17 PMJason Bosco
05/24/2023, 5:52 PMJason Bosco
05/24/2023, 5:53 PMcurl <http://localhost:8108/health>
and that is successful, and you’re running your backend on your local computer, then it could be an issue with how external network calls get routed in your backendJason Bosco
05/24/2023, 5:54 PMJason Bosco
05/24/2023, 5:54 PM