Troubleshooting
Common issues and solutions when using Raven Client.
Nudges Not Showing
Issue: Nudges don't appear
Possible Causes:
- Nudge screen not added to navigation stack
nudgeRouteNamedoesn't match route namefetchCTA()not called after initialization- CTA validation failing (frequency, expiration)
Solutions:
- Verify Nudge Screen is Added:
<Stack.Screen
name="Nudge"
component={Nudge}
options={{
headerShown: false,
presentation: 'transparentModal',
animation: 'fade',
}}
/>
- Check Route Name:
nudgeClient.init({
config: {
nudgeRouteName: 'Nudge', // Must match route name
// ...
},
});
- Ensure fetchCTA is Called:
useEffect(() => {
nudgeClient.init({ /* ... */ });
fetchCTA().catch(console.error);
}, []);
- Check CTA Validation:
- Verify frequency limits haven't been reached
- Check CTA expiration (
ctaValidTill) - Ensure behaviour tag exposure is valid
Tooltips Not Appearing
Issue: Tooltips don't show
Possible Causes:
- Navigation tracking not set up
testIDornativeIDdoesn't matchtargetId- Target element not mounted or visible
targetScreendoesn't match current screen
Solutions:
- Set Up Navigation Tracking:
import { useNavigationTracker } from '@dreamhorizonorg/raven-client';
function App() {
const navigationRef = useRef<NavigationContainerRef>(null);
useNavigationTracker(navigationRef);
// ...
}
- Verify Target ID:
// Component
<Button testID="signup-button" title="Sign Up" />
// Tooltip
TooltipSystem.show({
targetId: 'signup-button', // Must match testID
// ...
});
- Check Element Visibility:
- Ensure target element is mounted
- Verify element is visible on screen
- Check element isn't hidden or covered
- Verify Screen Name:
TooltipSystem.show({
targetId: 'button',
targetScreen: 'Home', // Must match current screen
// ...
});
API Errors
Issue: API requests failing
Possible Causes:
- Incorrect
baseUrl - Invalid access token
- Network connectivity issues
- Backend API errors
Solutions:
- Verify Base URL:
nudgeClient.init({
config: {
baseUrl: 'https://api.example.com', // Check URL is correct
// ...
},
});
- Check Access Token:
listeners: {
getAccessToken: () => {
const token = await getAuthToken(); // Ensure token is valid
return {
token: token,
tokenType: 'Bearer',
};
},
}
- Handle Network Errors:
fetchCTA()
.then(() => {
console.log('CTAs fetched');
})
.catch((error) => {
console.error('Failed to fetch CTAs:', error);
// Fallback: Load from storage
getCtaFromStorageToMemory();
});
State Machine Not Transitioning
Issue: State machine stays in same state
Possible Causes:
- Event name doesn't match
- Filters not passing
- No transition defined for event
- State machine expired (TTL)
Solutions:
- Verify Event Name:
// Event name must match exactly
processEventForCTAs({
eventName: 'USER_LOGIN', // Must match CTA configuration
// ...
});
- Check Filters:
- Verify filter conditions are met
- Check event properties match filter requirements
- Test filters with different event data
- Verify Transitions:
{
"stateTransition": {
"USER_LOGIN": { // Event name must match
"0": [{"transitionTo": "1"}]
}
}
}
- Check TTL:
{
"stateMachineTTL": 3600000 // State machine expires after 1 hour
}
CTAs Not Triggering
Issue: CTAs don't trigger on events
Possible Causes:
- CTAs not fetched
- Event not processed
- CTA validation failing
- Priority conflicts
Solutions:
- Ensure CTAs are Fetched:
useEffect(() => {
nudgeClient.init({ /* ... */ });
fetchCTA(); // Must be called
}, []);
- Process Events:
// Process events when they occur
processEventForCTAs({
eventName: 'USER_LOGIN',
routeName: 'Home',
is_from_rn: true,
actionDone: false,
});
- Check CTA Validation:
- Frequency limits
- Expiration dates
- Behaviour tag rules
- Group by requirements
- Check Priority:
{
"priority": 1 // Lower number = higher priority (1 is higher than 5)
}
Navigation Issues
Issue: Navigation not working
Possible Causes:
- Navigation ref not set
- Navigation container not set up
- Route names don't match
Solutions:
- Set Navigation Ref:
<NavigationContainer
ref={(ref) => {
navigationRef.current = ref;
setNavigationRef(ref); // Must call this
}}
>
- Verify Navigation Setup:
import { NavigationContainer } from '@react-navigation/native';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
Performance Issues
Issue: App performance degraded
Possible Causes:
- Too many active state machines
- Frequent API calls
- Large CTA configurations
Solutions:
- Limit State Machines:
{
"groupByConfig": {
"maxActiveStateMachineCount": 50 // Limit active machines
}
}
- Optimize API Calls:
- Use request queue
- Batch updates
- Cache CTAs locally
- Optimize CTA Config:
- Reduce filter complexity
- Limit context parameters
- Use efficient state transitions
Getting Help
If you're still experiencing issues:
-
Check Documentation:
-
Review Examples:
-
Report Issues:
- GitHub Issues
- Include error messages and logs
- Provide code examples
-
Ask Questions: