Troubleshooting
Common issues and solutions when working with the Silent Shard React Native SDK.
Installation Issues
Expo Compatibility Issues
For Expo users:
For the current version of libraries, doesn't support Expo Go projects.
However, Expo users can use the Expo prebuild to extract native modules. Then auto-link should handle the linking of the native dependencies.
Steps for Expo users:
- Run
npx expo prebuildto generate native code - Use
npx expo run:iosornpx expo run:androidinstead of Expo Go - The SDK will work with development builds but not with Expo Go
Package Not Found
If you encounter issues installing the SDK packages:
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@silencelaboratories/silent-shard-sdk
Solution: Make sure you have configured your package manager with the correct NPM token. See the installation guide for details.
Metro Bundle Issues
If you see Metro bundler errors after installation:
error: bundling failed: Error: Unable to resolve module
Solution:
- Clear Metro cache:
npx react-native start --reset-cache - Clean and rebuild:
cd ios && pod install && cd .. - For Expo:
npx expo start --clear
Runtime Issues
WebSocket Connection Failed
Error: WebSocket connection failed
Possible causes and solutions:
-
Incorrect endpoint: Verify your server endpoint
- For iOS simulator: Use
localhostor your machine's IP - For Android emulator: Use
10.0.2.2instead oflocalhost - For physical devices: Use your machine's IP address
- For iOS simulator: Use
-
SSL/TLS issues: Check the secure connection parameter
// For local development (HTTP)
const client = new CloudWebSocketClient("localhost:8080", false);
// For production (HTTPS)
const client = new CloudWebSocketClient("your-domain.com", true); -
Network permissions: Ensure your app has network permissions
Session Creation Failed
Error: Failed to create session
Solution: Verify your cloud verifying key is correct and matches your server configuration.
Key Generation Timeout
If key generation takes too long or times out:
- Check server status: Ensure your Duo server is running and accessible
- Network connectivity: Verify stable internet connection
- Server logs: Check server logs for any errors
Platform-Specific Issues
iOS Issues
CocoaPods Installation
[!] Unable to find a specification for `SilentShardSDK`
Solution:
- Update CocoaPods:
sudo gem install cocoapods - Clean pods:
cd ios && rm -rf Pods Podfile.lock && pod install
Simulator vs Device Differences
- Simulator: Use
localhostfor local development - Physical device: Use your computer's IP address
Android Issues
Network Security Config
For HTTP connections in development, you may need to configure network security:
<!-- android/app/src/main/res/xml/network_security_config.xml -->
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">10.0.2.2</domain>
<domain includeSubdomains="true">localhost</domain>
</domain-config>
</network-security-config>
Add to AndroidManifest.xml:
<application
android:networkSecurityConfig="@xml/network_security_config"
...>
Gradle Build Issues
If you encounter Gradle build errors:
- Clean build:
cd android && ./gradlew clean && cd .. - Update Gradle wrapper if needed
- Ensure minimum SDK version requirements are met
Common Error Messages
"Invalid keyshare format"
This usually indicates a storage or serialization issue:
- Clear app data/storage
- Regenerate keyshares
- Verify storage provider implementation
"Protocol version mismatch"
Ensure your SDK version is compatible with your server version:
- Check SDK version:
npm list @silencelaboratories/silent-shard-sdk - Update to latest compatible versions
- Verify server version compatibility
Performance Issues
Slow Key Generation
If key generation is slower than expected:
- Device performance: Test on different devices
- Network latency: Check connection to server
- Server resources: Ensure server has adequate resources
Memory Issues
For memory-related crashes:
- Storage cleanup: Implement proper keyshare cleanup
- Session management: Properly dispose of sessions
- Memory profiling: Use development tools to identify leaks
Getting Help
If you continue to experience issues:
- Check logs: Enable debug logging and check both client and server logs
- Documentation: Review the setup guide and API reference
- Contact support: Reach out to info@silencelaboratories.com with:
- SDK version
- Platform details (iOS/Android version)
- Error messages and logs
- Steps to reproduce the issue
Debug Mode
Enable debug logging for more detailed error information:
// Add this before creating your session
console.log("Debug mode enabled");
// Monitor WebSocket events
const client = new CloudWebSocketClient(endpoint, secure);
// Add event listeners for debugging if available in your SDK version
Remember to disable debug logging in production builds for security and performance reasons.