Troubleshooting
Common issues and solutions for CoderspaE platform
Authentication Issues
❌ Invalid API Key Error
Error: 401 Unauthorized - Invalid API keyPossible causes:
- • API key is missing or incorrect
- • API key has been revoked or expired
- • Using wrong environment (dev key in production)
- • Extra spaces or characters in the key
Solutions:
- • Verify API key in your dashboard
- • Check environment variables are properly set
- • Regenerate API key if necessary
- • Ensure no trailing whitespace in key
❌ Rate Limit Exceeded
Error: 429 Too Many Requests - Rate limit exceededSolutions:
- • Implement exponential backoff in your requests
- • Cache responses to reduce API calls
- • Use batch endpoints when available
- • Consider upgrading to a higher tier plan
// Retry with exponential backoff
async function retryRequest(fn, retries = 3) {
for (let i = 0; i < retries; i++) {
try {
return await fn();
} catch (error) {
if (error.status === 429 && i < retries - 1) {
await new Promise(resolve =>
setTimeout(resolve, Math.pow(2, i) * 1000)
);
continue;
}
throw error;
}
}
}Battle Issues
❌ Code Submission Failed
Common causes:
- • Syntax errors in submitted code
- • Code execution timeout (>30 seconds)
- • Memory limit exceeded (>512MB)
- • Unsupported language features
- • Network connectivity issues
Debug steps:
- 1. Test your code locally first
- 2. Check console for detailed error messages
- 3. Verify function signature matches requirements
- 4. Ensure efficient algorithm (avoid infinite loops)
- 5. Try submitting again if network issue
❌ Unable to Join Battle
Possible reasons:
- • Battle is already full
- • Battle has already started
- • Rating requirement not met
- • Already participating in another battle
- • Private battle (invitation required)
Solutions:
- • Create a new battle instead
- • Wait for current battle to finish
- • Check battle requirements
- • Request invitation from battle creator
❌ WebSocket Connection Issues
Symptoms:
- • No real-time updates during battles
- • Connection drops frequently
- • Battle status not updating
// WebSocket reconnection logic
const socket = client.connect();
socket.on('disconnect', () => {
console.log('WebSocket disconnected');
// Attempt reconnection after delay
setTimeout(() => {
socket.connect();
}, 5000);
});
socket.on('reconnect', () => {
console.log('WebSocket reconnected');
// Rejoin battle rooms if needed
socket.joinBattle(currentBattleId);
});SDK Issues
❌ Import/Module Errors
Error: Cannot resolve module @coderspae/sdkSolutions:
- 1. Verify SDK installation:
npm list @coderspae/sdk - 2. Reinstall if necessary:
npm install @coderspae/sdk - 3. Clear node_modules and reinstall:
rm -rf node_modules && npm install - 4. Check Node.js version compatibility (requires Node 16+)
❌ TypeScript Declaration Issues
Error: Could not find declaration file for module @coderspae/sdkSolutions:
- • Update to latest SDK version:
npm update @coderspae/sdk - • Install type definitions:
npm install --save-dev @types/coderspae__sdk - • Add to tsconfig.json:
"skipLibCheck": true
Performance Issues
⚠️ Slow API Responses
Optimization strategies:
- • Use pagination for large datasets
- • Implement client-side caching
- • Use specific field selection in queries
- • Consider upgrading to premium tier for better performance
// Efficient pagination
const battles = await client.battles.list({
limit: 25,
offset: 0,
fields: ['id', 'status', 'createdAt'] // Only fetch needed fields
});
// Client-side caching
const cache = new Map();
const cacheKey = `battles_${limit}_${offset}`;
if (cache.has(cacheKey)) {
return cache.get(cacheKey);
}
const result = await client.battles.list({ limit, offset });
cache.set(cacheKey, result);
return result;⚠️ Memory Usage Issues
Best practices:
- • Disconnect WebSocket connections when not needed
- • Clear large cached data periodically
- • Use streaming for large data transfers
- • Implement proper cleanup in component unmount
Debugging Tools
🔍 Enable Debug Mode
const client = new CoderspaE({
apiKey: process.env.CODERSPAE_API_KEY,
debug: true, // Enable detailed logging
logLevel: 'debug' // debug | info | warn | error
});
// Enable WebSocket debugging
client.on('debug', (message) => {
console.log('[CoderspaE Debug]:', message);
});📊 Health Check
// Check API connectivity and status
const healthCheck = await client.health.check();
console.log('API Status:', healthCheck.status);
console.log('Response Time:', healthCheck.responseTime);
console.log('Rate Limit Remaining:', healthCheck.rateLimit.remaining);
// Test WebSocket connection
const socket = client.connect();
socket.on('connect', () => {
console.log('✅ WebSocket connected successfully');
});
socket.on('error', (error) => {
console.error('❌ WebSocket error:', error);
});Getting Help
📞 Support Channels
Discord Community
Fastest response for general questions
discord.gg/coderspaeEmail Support
For account and billing issues
support@coderspae.comGitHub Issues
For SDK bugs and feature requests
github.com/coderspae/sdk📋 When Reporting Issues
Include:
- • SDK version and platform details
- • Complete error messages and stack traces
- • Minimal code example that reproduces the issue
- • Steps to reproduce the problem
- • Expected vs actual behavior
💡 Tip: Use debug mode and include debug logs when reporting issues