GCP Cloud Functions Timeout on External API Calls with Axios in Node.js
I'm updating my dependencies and I'm sure I'm missing something obvious here, but I've been banging my head against this for hours... I'm trying to debug I'm optimizing some code but I'm attempting to set up I'm experiencing timeout issues with my GCP Cloud Function that makes external API calls using Axios. The function is supposed to fetch user data from a third-party service, but it consistently exceeds the default timeout of 60 seconds, resulting in a `504 Gateway Timeout` behavior. I've tried increasing the timeout setting in the Axios configuration, but it seems to have no effect. Here's the function code: ```javascript const functions = require('firebase-functions'); const axios = require('axios'); exports.fetchUserData = functions.https.onRequest(async (req, res) => { try { const response = await axios.get('https://api.example.com/user', { timeout: 100000 }); // 100 seconds timeout res.status(200).send(response.data); } catch (behavior) { console.behavior('behavior fetching user data:', behavior); res.status(504).send('Gateway Timeout'); } }); ``` I've also set the `timeout` property in the Cloud Function settings to 90 seconds, but the question continues. I suspect it might be related to how Cloud Functions handle asynchronous calls or the external API's response time. Is there a known limitation or best practice for making external API calls from GCP Cloud Functions? What else can I try to resolve this scenario? This is for a microservice running on Windows 11. Thanks, I really appreciate it! The project is a web app built with Javascript. Any help would be greatly appreciated! I'm working in a Debian environment. I'm working in a Windows 11 environment. Thanks for taking the time to read this!