Firebase Cloud functions error 'Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com'

When I deploy the algolia search in my app it works really well. But the other cloud functions which I have deployed works only when algolia search is not deployed. I get the following error in the logs
Unreachable hosts - your application id may be incorrect.

My application Id is correct and I am using the firebase blaze plan.

Sharing my code below

algolia.js

const ALGOLIA_APP_ID = APP_ID;
const functions = require("firebase-functions");
const ALOGOLIA_ADMIN_KEY = API_KEY;
const ALGOLIA_INDEX_NAME = 'profile_card';
const client = algoliasearch(ALGOLIA_APP_ID, ALOGOLIA_ADMIN_KEY);
const index = client.initIndex(ALGOLIA_INDEX_NAME);


index.setSettings({ searchableAttributes: ['username', '_tags'], attributesForFaceting: ['searchable(_tags)'], removeStopWords: true });
exports.createPost = functions.firestore
    .document('EUU/{euId}')
    .onCreate(async (snap, context) => {
        const newValue = snap.data();
        newValue.objectID = snap.id;
        return index.saveObject(newValue);
        console.log('Finished');
    });

exports.updatePost = functions.firestore
    .document('EUU/{euId}')
    .onUpdate(async (snap, context) => {
        const afterUpdate = snap.after.data();
        afterUpdate.objectID = snap.after.id;
        return index.saveObject(afterUpdate);
    });

exports.deletePost = functions.firestore
    .document('EUU/{euId}')
    .onDelete(async (snap, context) => {
        const oldID = snap.id;
        return index.deleteObject(oldID);
    });

index.js

type or paste code here