Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
Firebase function timeout when calling external api

I'm trying to call an external API in Firebase Functions but i always get a timeout. What can be the issue causing this?

Here is my code

exports.getCountryData = functions.https.onRequest((request, response) => {

const https = require('https');
const options = {
  hostname: "api-football-v1.p.rapidapi.com/v3",
  path: '/fixtures?next=5',
  headers: {
    "x-rapidapi-host": "api-football-v1.p.rapidapi.com/v3",
    "x-rapidapi-key": "my-api-key"
  }
};
  var req = https.get(options, (resp) => {
    let data = '';
    resp.on('data', (chunk) => { data += chunk; });
    resp.on('end', () => {
        var result = JSON.parse(data);
        console.log("Api fetched successfully");

        console.log(result);
   
        response.send({ fulfillmentText: result});
      });
    }).on("error", (err) => { console.log("Error: " + err.message); });
});
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!