Closed daaibraanies closed 3 years ago
Hey @daaibraanies, the issue here is actually that you are trying to use this library inside of a React Native application and that is not supported.
The Twilio Node library requires your API secrets in order to make requests to the Twilio API. However it is not safe to expose those secrets to a client side application as a malicious user could intercept them and use them to abuse your Twilio account.
To make calls to the Twilio API from your React Native application we recommend you build your own server side component that proxies the API call from the app, like in this example of sending an SMS from a React application.
When importing 'twilio' lib into an empty react-native application and running
npm install
, the app spits errors such ascould not find url module
. After manually installing the modules the lib requires, it comes to the 'crypto' module after installation of which the error occurs:If you check installed crypto module folder you will find readme file there saying:
Could someone help with identifying what causes the problem and perhaps a solution? Much appreciated!
Env. info: System: OS: macOS 10.15.7 CPU: (8) x64 Intel(R) Core(TM) i7-3740QM CPU @ 2.70GHz Memory: 1.08 GB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 14.13.0 - /usr/local/bin/node Yarn: 1.22.5 - /usr/local/bin/yarn npm: 6.14.8 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.9.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 13.6, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: 11.6/11E708 - /usr/bin/xcodebuild Languages: Java: 1.7.0_79 - /usr/bin/javac Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz => 0.63.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found