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

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

我想将云 firestore 数据发送到 algolia 以启用全文搜索。 Firebase 云功能日志显示有关应用程序 ID 的错误。我无法理解此错误以及如何解决此问题。

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

这是我的 index.js 文件

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);
  })
})

出站请求(Google 服务之外)只能从付费计划 (https://firebase.google.com/pricing) 的功能中发出。

错误的 appID 错误的原因是 Algolia 正在尝试使用您的 appID 解析 dns,但失败了。参见 https://github.com/algolia/algoliasearch-client-javascript/issues/587#issuecomment-407397688

您必须退出免费的 Spark 计划才能从您的函数调用 Algolia..