I'm trying to use firebase cloud functions to create a proxy to an external json api. But right now I'm just trying to get it all set up.
I wrote this function:
exports.helloWorld = functions.https.onRequest((request, response) => { request.get('http://www.google.com', function (error, response, body) { if (!error && response.statusCode == 200) { console.log(body) // Print the google web page. } }) }); I then run the firebase functions emulator and run
curl http://localhost:5000/<project-id>/us-central1/helloWorld It returns a message saying the function was triggered, starting execution, but then it just sits there and spins until eventually it times out.
{"error":{"code":500,"status":"INTERNAL","message":"function execution attempt timed out"}} I'm not sure what I'm doing wrong.
........
EDIT
This function works perfectly:
exports.helloWorld = functions.https.onRequest((request, response) => { response.send('test'); })