Troubleshooting
This section covers common issues you might encounter when using the Nexla SDK and provides solutions to resolve them.
Common Issues
Authentication Problems
Issue: AuthenticationError
Symptoms: Getting AuthenticationError when making API calls
Solutions:
-
Verify Service Key:
Check Service Keyimport os
print(f"Service key set: {bool(os.getenv('NEXLA_SERVICE_KEY'))}") -
Test Authentication:
Test Authfrom nexla_sdk import NexlaClient
try:
client = NexlaClient()
# Simple call to test auth
projects = client.projects.list()
print("✅ Authentication successful")
except AuthenticationError as e:
print(f"❌ Authentication failed: {e}") -
Check Key Format:
- Ensure your service key is complete and not truncated
- Verify there are no extra spaces or characters
- Check if the key has expired
Issue: Invalid Credentials
Symptoms: Getting 401 errors even with valid-looking credentials
Solutions:
- Regenerate Service Key: Create a new service key in the Nexla UI
- Check Environment Variables:
Check Environment
echo $NEXLA_SERVICE_KEY
echo $NEXLA_ACCESS_TOKEN
echo $NEXLA_API_URL
Connection Issues
Issue: Connection Timeout
Symptoms: Requests timing out or hanging
Solutions:
-
Check Network Connectivity:
Test Connectionimport requests
try:
response = requests.get("https://your-instance.nexla.io/nexla-api/health", timeout=10)
print(f"Connection test: {response.status_code}")
except requests.exceptions.RequestException as e:
print(f"Connection failed: {e}") -
Increase Timeout:
Custom Timeoutclient = NexlaClient(timeout=60) # 60 second timeout -
Check Firewall/Proxy Settings:
- Ensure your network allows HTTPS traffic to Nexla
- Configure proxy settings if needed
Issue: SSL Certificate Errors
Symptoms: SSL verification errors
Solutions:
-
Update Certificates:
Update Certificatespip install --upgrade certifi -
Check System Time: Ensure your system clock is correct
API Errors
Issue: ValidationError (400)
Symptoms: Getting validation errors when creating resources
Solutions:
-
Check Required Fields:
Validate Payloadpayload = {
"name": "My Resource",
"type": "s3",
# Ensure all required fields are present
} -
Validate Data Types:
Type Validation# Ensure numeric fields are numbers, not strings
payload = {
"timeout": 30, # Not "30"
"retries": 3 # Not "3"
}
Issue: NotFoundError (404)
Symptoms: Resources not found when they should exist
Solutions:
-
Verify Resource IDs:
Check Resource Existstry:
resource = client.flows.get("your-flow-id")
except NotFoundError:
print("Resource not found. Check the ID.") -
List Resources First:
List Before Getflows = client.flows.list()
if flows:
flow_id = flows[0].id
flow = client.flows.get(flow_id)
Issue: ResourceConflictError (409)
Symptoms: Getting conflicts when creating resources
Solutions:
-
Check for Existing Resources:
Check Existingexisting = client.destinations.list(name="My Destination", per_page=1)
if existing:
print("Resource already exists") -
Use Create or Update Pattern:
Create or Updatetry:
resource = client.destinations.create(payload)
except ResourceConflictError:
existing = client.destinations.list(name=payload["name"], per_page=1)
if existing:
resource = client.destinations.update(existing[0].id, payload)
Performance Issues
Issue: Slow API Calls
Symptoms: API calls taking too long
Solutions:
-
Use Pagination:
Pagination# Instead of getting all at once
flows = client.flows.list(per_page=50) -
Filter Results:
Filtering# Use filters to reduce data
flows = client.flows.list(status="running") -
Check Rate Limits:
Check Rate Limitsrate_limits = client.metrics.get_rate_limits()
print(f"Rate limits: {rate_limits}")
Issue: Memory Usage
Symptoms: High memory usage with large datasets
Solutions:
-
Process in Batches:
Batch Processingdef process_flows_in_batches(batch_size=100):
page = 1
while True:
flows = client.flows.list(per_page=batch_size, page=page)
if not flows:
break
# Process batch
for flow in flows:
process_flow(flow)
page += 1 -
Use Generators:
Generator Patterndef get_all_flows():
page = 1
while True:
flows = client.flows.list(per_page=100, page=page)
if not flows:
break
for flow in flows:
yield flow
page += 1
Debugging Tips
Enable Debug Logging
import logging
# Enable debug logging
logging.basicConfig(level=logging.DEBUG)
# Initialize client
client = NexlaClient()
Check SDK Version
import nexla_sdk
print(f"SDK Version: {nexla_sdk.__version__}")
Test Basic Connectivity
def test_connectivity():
"""Test basic connectivity to Nexla API"""
try:
# Simple API call
projects = client.projects.list()
print(f"✅ Connected successfully. Found {len(projects)} projects.")
return True
except Exception as e:
print(f"❌ Connection failed: {e}")
return False
test_connectivity()
Validate Configuration
def validate_config():
"""Validate SDK configuration"""
import os
print("Configuration Check:")
print(f" Service Key: {'✅ Set' if os.getenv('NEXLA_SERVICE_KEY') else '❌ Not set'}")
print(f" Access Token: {'✅ Set' if os.getenv('NEXLA_ACCESS_TOKEN') else '❌ Not set'}")
print(f" API URL: {os.getenv('NEXLA_API_URL', 'Using default')}")
# Check for conflicting auth methods
if os.getenv('NEXLA_SERVICE_KEY') and os.getenv('NEXLA_ACCESS_TOKEN'):
print("⚠️ Both service key and access token are set. Service key takes precedence.")
validate_config()
Getting Help
Check Documentation
- API Reference - Complete method documentation
- Examples & Tutorials - Working code examples
- Error Handling - Detailed error management
SDK Guides
- FAQ - Frequently asked questions
- Error Handling & Retries - Detailed error patterns
- Rate Limits & Idempotency - Rate limiting strategies
Support Resources
- GitHub Issues: Report bugs and request features
- Community Forum: Ask questions and share solutions
- Support Email: Contact support for urgent issues
Next Steps
- Error Handling - Comprehensive error management
- Rate Limits & Retries - Handling rate limiting
- Operations - Monitoring and observability
When troubleshooting, always start with the simplest possible test case and gradually add complexity. This helps isolate the root cause of issues.