How to fix the error : your application id may be incorrect. If the error persists, contact support@algolia.com

Viewed 2435

I want to send cloud firestore data to algolia to enable full-text search. Firebase cloud function log is showing an error about application id. I am not able to understand this error and how to fix this.

 name: 'RetryError',
  message: 'Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.'

This is my index.js file

exports.addFirestoreDataToAlgolia = 
functions.https.onRequest((req, res) => {
  var arr = [];
  admin.firestore().collection("tags").get()
  .then((docs) => {
    docs.forEach((doc) => {
      let user = doc.data();
      user.objectID = doc.id;
      arr.push(user);
    })
    const client = algoliasearch(ALGOLIA_ID, ALGOLIA_ADMIN_KEY);
    const index = client.initIndex(ALGOLIA_INDEX_NAME);
    return index.saveObjects(arr, (err, content) => {
      if (err) {
        res.status(500);
      }
      else {
        res.status(200).send(content);
      }
    })
  })
  .catch( err => {
    console.log(err);
  })
})
1 Answers
Related