Records not being updated in algolia

I am using flutter with firebase and trying to use algolia service, I created a index.ts and followed all the basic steps, I even got a Deploy Complete message and the function is getting listed in the firebase to but still the records are not uploaded to algolia.
Here is my index.ts file

// Import all needed modules.
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
import algoliasearch from 'algoliasearch';

// Set up Firestore.
const db = admin.firestore();

// Set up Algolia.
// The app id and API key are coming from the cloud functions environment, as we set up in Part 1, Step 3.
const algoliaClient = algoliasearch(functions.config().algolia.appid, functions.config().algolia.apikey);
// Since I'm using develop and production environments, I'm automatically defining 
// the index name according to which environment is running. functions.config().projectId is a default 
// property set by Cloud Functions.
const collectionIndexName = functions.config().projectId === 'Microlearning-11737' ? 'decks' : 'decks';
c`Preformatted text`onst collectionIndex = algoliaClient.initIndex(collectionIndexName);

// Create a HTTP request cloud function.
export const sendCollectionToAlgolia = functions.https.onRequest(async (req, res) => {

// This array will contain all records to be indexed in Algolia.
// A record does not need to necessarily contain all properties of the Firestore document,
// only the relevant ones. 
const algoliaRecords : any[] = [];

// Retrieve all documents from the COLLECTION collection.
const querySnapshot = await db.collection('decks').get(); => {
	const document =;
    // Essentially, you want your records to contain any information that facilitates search, 
    // display, filtering, or relevance. Otherwise, you can leave it out.
    const record = {
        deckName: document.deckName


// After all records are created, we save them to 
collectionIndex.saveObjects(algoliaRecords, (_error: any, content: any) => {
    res.status(200).send("COLLECTION was indexed to Algolia successfully.");


Hi @keshav.bajaj, welcome to the community!

Sorry to hear that your records are not being updates. Are you receiving any error message from the saveObjects call? In order to do so, could you please make sure that callback function you are passing into the call logs any errors?

Also, just to double check, are you using a paid Firebase plan? Unfortunately, Firebase’s free plan only allows for network requests to Google services. You can see it on their pricing page, under the section Outbound networking - . We have found this to be the most common cause for issues, as it leads to timeouts when trying to index records to Algolia.