Skip to main content

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:

  1. Run npx expo prebuild to generate native code
  2. Use npx expo run:ios or npx expo run:android instead of Expo Go
  3. 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:

  1. Clear Metro cache: npx react-native start --reset-cache
  2. Clean and rebuild: cd ios && pod install && cd ..
  3. For Expo: npx expo start --clear

Runtime Issues

WebSocket Connection Failed
Error: WebSocket connection failed

Possible causes and solutions:

  1. Incorrect endpoint: Verify your server endpoint

    • For iOS simulator: Use localhost or your machine's IP
    • For Android emulator: Use 10.0.2.2 instead of localhost
    • For physical devices: Use your machine's IP address
  2. 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);
  3. 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:

  1. Check server status: Ensure your Duo server is running and accessible
  2. Network connectivity: Verify stable internet connection
  3. Server logs: Check server logs for any errors

Platform-Specific Issues

iOS Issues

CocoaPods Installation
[!] Unable to find a specification for `SilentShardSDK`

Solution:

  1. Update CocoaPods: sudo gem install cocoapods
  2. Clean pods: cd ios && rm -rf Pods Podfile.lock && pod install
Simulator vs Device Differences
  • Simulator: Use localhost for 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:

  1. Clean build: cd android && ./gradlew clean && cd ..
  2. Update Gradle wrapper if needed
  3. Ensure minimum SDK version requirements are met

Common Error Messages

"Invalid keyshare format"

This usually indicates a storage or serialization issue:

  1. Clear app data/storage
  2. Regenerate keyshares
  3. Verify storage provider implementation
"Protocol version mismatch"

Ensure your SDK version is compatible with your server version:

  1. Check SDK version: npm list @silencelaboratories/silent-shard-sdk
  2. Update to latest compatible versions
  3. Verify server version compatibility

Performance Issues

Slow Key Generation

If key generation is slower than expected:

  1. Device performance: Test on different devices
  2. Network latency: Check connection to server
  3. Server resources: Ensure server has adequate resources
Memory Issues

For memory-related crashes:

  1. Storage cleanup: Implement proper keyshare cleanup
  2. Session management: Properly dispose of sessions
  3. Memory profiling: Use development tools to identify leaks

Getting Help

If you continue to experience issues:

  1. Check logs: Enable debug logging and check both client and server logs
  2. Documentation: Review the setup guide and API reference
  3. 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.