I am trying to make ~25 requests to fetch some data and save the response to separate files. I am using the npm request module to make the requests with a basic google cloud
I was able to resolve by updating to use Promise.all()
and mapping the request calls to promise objects using new Promise
. Returning Promise.all()
to the main Google Cloud Function body let's the function know to wait for all promises to finish before exiting the function. Implementing callbacks instead of promises may cause the Google cloud function to exit prematurely before all callbacks are finished.