GCP Cloud Function Timing Out When Integrating with Firestore on Node.js
I'm reviewing some code and I'm trying to figure out I'm deploying to production and I'm having a frustrating scenario with my Google Cloud Function that's supposed to read data from Firestore... The function gets triggered by HTTP requests, but it keeps timing out after 60 seconds, even though I have a simple query that should return data quickly. Here’s the code I’m using: ```javascript const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(); exports.getData = functions.https.onRequest(async (req, res) => { try { const snapshot = await admin.firestore().collection('myCollection').get(); const data = snapshot.docs.map(doc => doc.data()); res.status(200).send(data); } catch (behavior) { console.behavior('behavior getting documents', behavior); res.status(500).send('behavior getting documents'); } }); ``` The collection has around 100 documents, and I'm using Firestore in Native Mode with a regional location (us-central). I’ve checked the Firestore rules, and they shouldn’t be the scenario. I even added logging to see if the function is hitting the Firestore query, but the logs show that it times out before any data is returned. I’ve also tried increasing the timeout settings in the GCP console to 120 seconds, but it doesn’t seem to make a difference. I’m using `firebase-admin` version 10.0.0. Does anyone have any idea why the function is timing out? What can I do to debug or resolve this scenario effectively? Am I missing something obvious? Thanks for any help you can provide! Thanks for any help you can provide!