[SOLVED] Api call to local host not working cloud function

When I call local host rest api through ip address from my phone in browser, it works, but when i use moralis httprequest, it takes about 20 seconds of loading, and then says bad gateway. Ive also tested the http request and it is working, just not with the local host url. Does anyone know why this is happening? thanks

you can not access local host from a cloud function. the cloud function runs on a server and not on current system and that is why it can not access your local host from your local system

so is there a way to call my rest api through cloud functions

you have to make that rest API accessible over the internet first and then you can call it

1 Like