我可以在云函数中使用第 3 方 React Native 库吗?

Can I use a 3rd party React Native library within a cloud function?

我想做一些功能,让我的 Cloud Function 将从 firestore 检索到的信息安全地存储到 react-native-keychain 中。我的问题是我可以将钥匙串库导入到我的函数文件夹中的 index.js 文件中以供使用。 比如这样:

const keyChain = require("react-native-keychain");

这给了我这个错误:

Cloud Functions 运行 在 Google 的服务器上,其中没有 React Native Keychain 可用。

如果您需要该库在您的 Cloud Functions 代码中提供的功能,您需要寻找在 server-side Node.js 环境中提供该功能的其他库。

如果您需要来自 React Native 应用程序内部钥匙串的信息可用于 Cloud Functions,您需要在 React Native 代码中读取它,并在调用它时将其传递给 Cloud Functions .