Troubleshooting
Common issues and their solutions.
Connection Issues
Cannot Connect to Conviso API
Symptoms:
ENOTFOUNDor DNS lookup errors- Connection timeout errors
Solutions:
- Verify API endpoint:
const client = new CDPClient({
cdpApiKey: 'your-key',
debug: true // See connection details
});
await client.ping(); // Test connection
- Check network connectivity:
curl https://api.opencdp.io/gateway/data-gateway/v1/health/ping
- Verify firewall rules allow outbound HTTPS traffic
Authentication Errors (401)
Symptoms:
401 Unauthorizederrors- "Invalid API key" messages
Solutions:
- Verify API key is correct:
console.log('API Key:', process.env.CDP_API_KEY?.substring(0, 10) + '...');
- Check environment variables are loaded:
import dotenv from 'dotenv';
dotenv.config();
- Ensure API key isn't expired or revoked
Request Failures
Timeout Errors
Symptoms:
ECONNABORTEDerrors- Requests taking too long
Solutions:
- Increase timeout:
const client = new CDPClient({
cdpApiKey: 'your-key',
timeout: 30000 // 30 seconds
});
-
Check network latency
-
Reduce concurrent requests:
maxConcurrentRequests: 10 // Lower value
Rate Limiting (429)
Symptoms:
429 Too Many Requestserrors
Solutions:
- Implement exponential backoff:
async function identifyWithBackoff(userId: string, properties: any) {
let delay = 1000;
for (let i = 0; i < 5; i++) {
try {
return await client.identify(userId, properties);
} catch (error) {
if (error.response?.status === 429) {
await sleep(delay);
delay *= 2;
continue;
}
throw error;
}
}
}
- Reduce concurrency:
maxConcurrentRequests: 5
- Add delays between batches:
for (const batch of batches) {
await processBatch(batch);
await sleep(1000); // 1 second delay
}
Email Issues
Template Not Found (404)
Symptoms:
404 Not Founderrors when sending emails- "Template not found" messages
Solutions:
- Verify template ID exists in CDP
- Check template ID is spelled correctly
- Ensure template is published/active
Email Not Delivered
Symptoms:
- Email sends successfully but not received
Checklist:
- Check spam folder
- Verify email address is valid
- Check email logs in Conviso dashboard
- Verify sender domain is configured
- Check bounce/complaint rates
Validation Errors
Symptoms:
- "Invalid email address format"
- "to is required"
Solutions:
// Validate before sending
function isValidEmail(email: string): boolean {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
}
if (!isValidEmail(email)) {
throw new Error('Invalid email');
}
Push Notification Issues
No Devices Registered
Symptoms:
- Push sends successfully but not received
- "No registered devices" error
Solutions:
- Verify device registration:
await client.registerDevice(userId, {
deviceId: 'device_abc',
platform: 'ios',
fcmToken: 'valid_token'
});
-
Check FCM token is valid and not expired
-
Verify user has at least one registered device
Push Not Received
Checklist:
- Check device has push notifications enabled
- Verify FCM configuration in Firebase
- Check app is not in background (iOS)
- Verify APNS certificate (iOS)
- Check FCM token hasn't expired
Customer.io Dual-Write Issues
Customer.io Requests Failing
Symptoms:
- Customer.io errors in logs
- Data not appearing in Customer.io
Solutions:
- Verify Customer.io credentials:
const client = new CDPClient({
cdpApiKey: 'your-cdp-key',
sendToCustomerIo: true,
customerIo: {
siteId: 'verify_this',
apiKey: 'verify_this',
region: 'us' // or 'eu'
},
debug: true // See error details
});
-
Check correct region (US vs EU)
-
Verify Customer.io API key has correct permissions
Duplicate Messages
Symptoms:
- Users receiving duplicate emails
Solutions:
- Disable dual-write for emails:
// Emails are NOT dual-written by design
// If getting duplicates, check for manual Customer.io calls
- Remove manual Customer.io calls if using Conviso SDK
Performance Issues
Memory Leaks
Symptoms:
- Memory usage growing over time
- Application crashes
Solutions:
- Disable debug mode in production:
debug: false
-
Use single client instance (singleton pattern)
-
Don't create multiple client instances
Debugging
Enable Debug Mode
const client = new CDPClient({
cdpApiKey: 'your-key',
debug: true // Detailed logs
});
Custom Logger
import pino from 'pino';
const logger = pino();
const client = new CDPClient({
cdpApiKey: 'your-key',
cdpLogger: {
debug: (msg) => logger.debug(msg),
error: (msg, ctx) => logger.error(ctx, msg),
warn: (msg) => logger.warn(msg)
}
});
Test Connection
try {
await client.ping();
console.log('Connection successful!');
} catch (error) {
console.error('Connection failed:', {
message: error.message,
code: error.code,
status: error.response?.status
});
}
Getting Help
If you're still experiencing issues:
- Enable debug mode and collect logs
- Document the error with full stack trace
- Note your configuration (without API keys)
- Provide code sample that reproduces the issue
- Contact support with all details