title: Third party API call through Firebase Cloud functions ( with Blaze plan). React/Redux
body: <p>I'm trying to use a Firebase cloud function to make an axios get request to a 3rd party API (Yelp). From what i read so far on related questions, other devs ran into similar issues mostly because they were on the <strong>spark</strong> plan, or didn't enable cors. I myself am currently on the <strong>Blaze</strong> plan.</p>
  
  <p>Here is a breakdown of the issue:</p>
  
  <p><strong>-Using:</strong> React/Redux</p>
  
  <p><strong>-steps:</strong></p>
  
  <p>1-I wrote a function in my actions file (/actions/index), that makes an axios call to the firebase cloud function</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>/*actions/index.js*/
  import { dbConfig } from "../config/firebase";
  import { LOGIN, LOAD_USERS, LOAD_ACTIVITIES, SEARCH_VENUE, RETRIEVEMATCH, SAVE_VENUE } from "./types";
  import axios from "axios";
  
  
  export const searchActivities = (search) =&gt; async(dispatch) =&gt; {
    /*call to cloud function*/
    axios.get("https://us-central1-we-party-210101.cloudfunctions.net/searchActivities", {headers:{ Authorization: `Bearer ${dbConfig.apiKey}`}})
    .then(res =&gt; {
      console.log(" search venue res: ", res.data);
      dispatch({
        type: SEARCH_VENUE,
        payload: res.data
      })
    })
    .catch( e =&gt; {
      console.log("searchActivities error: ", e);
    })
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>2-In the cloud function (/functions/index), I enable <strong>cors</strong> , add my Yelp api token as an authorization header and make the get request.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>/*/functions/index.js*/
  const functions = require('firebase-functions');
  const cors = require('cors')({origin: true});
  var axios = require('axios');
  var tokens = require('./functionSecrets');
  
  // this function works fine when called the exact same way as the one below
  exports.helloWorld = functions.https.onRequest((request, response) =&gt; {
    console.log("Hello World");
  });
  
  exports.searchActivities = functions.https.onRequest( (request, response) =&gt; {
    // enable cors 
    cors(request, response, () =&gt; {
      // request to yelp api
      axios.get("https://api.yelp.com/v3/businesses/search", {headers:{ Authorization: `bearer ${tokens.yelpKey}`}})
      .then(r =&gt; {
        console.log("Cloud yelp resp", r);
      })
      .catch( e =&gt; {
        console.log( "Cloud yelp error: ", e);
      })
    })
  
  })</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>-desired behavior:</strong></p>
  
  <p>Yelp api response body is logged in my dev tools console. <em>NOTE:</em> I'm not worried about the dispatching in my actions file at this point since I'm not even getting the response in the first place.</p>
  
  <p><strong>-Actual behavior:</strong></p>
  
  <p>The request timesout after taking 6s to run. <em>NOTE:</em> that same request takes about 0.8 s on my local server. 
  Below are the logs in my Firebase functions :</p>
  
  <blockquote>
    <p>searchActivities
    Function execution took 60003 ms, finished with status: 'timeout'</p>
  </blockquote>
  
  <p>I'm fairly new to development in general, and I don't see what I'm missing here. I'm convinced it's a small thing and would love for anyone to point me in the right direction.</p>
  
  <p>Thanks in advance for your help!</p>
  
  <p><strong>P.S</strong>: I made sure to go through similar questions, but in case this still ends up being a duplicate, my apologies in advance.</p>