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

Time:02-11

I want to do some functionality where my Cloud Function will securely store information it retrieves from firestore into react-native-keychain. My question is I can import the keychain library into my index.js file in my functions folder to use. Such as this:

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

Which gives me this error: enter image description here

CodePudding user response:

Cloud Functions run on Google's servers, where no React Native Keychain is available.

If you need the functionality that library provides in your Cloud Functions code, you'll need to look for a different library that provides the functionality in a server-side Node.js environment.

If you need the information from the keychain inside the React Native app to be available to the Cloud Function, you'll need to read it inside your React Native code, and pass it to the Cloud Function when you call it.

  • Related