Skip to main content

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:

  1. Verify Service Key:

    Check Service Key
    import os
    print(f"Service key set: {bool(os.getenv('NEXLA_SERVICE_KEY'))}")
  2. Test Authentication:

    Test Auth
    from 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}")
  3. 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:

  1. Regenerate Service Key: Create a new service key in the Nexla UI
  2. 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:

  1. Check Network Connectivity:

    Test Connection
    import 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}")
  2. Increase Timeout:

    Custom Timeout
    client = NexlaClient(timeout=60)  # 60 second timeout
  3. 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:

  1. Update Certificates:

    Update Certificates
    pip install --upgrade certifi
  2. Check System Time: Ensure your system clock is correct

API Errors

Issue: ValidationError (400)

Symptoms: Getting validation errors when creating resources

Solutions:

  1. Check Required Fields:

    Validate Payload
    payload = {
    "name": "My Resource",
    "type": "s3",
    # Ensure all required fields are present
    }
  2. 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:

  1. Verify Resource IDs:

    Check Resource Exists
    try:
    resource = client.flows.get("your-flow-id")
    except NotFoundError:
    print("Resource not found. Check the ID.")
  2. List Resources First:

    List Before Get
    flows = 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:

  1. Check for Existing Resources:

    Check Existing
    existing = client.destinations.list(name="My Destination", per_page=1)
    if existing:
    print("Resource already exists")
  2. Use Create or Update Pattern:

    Create or Update
    try:
    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:

  1. Use Pagination:

    Pagination
    # Instead of getting all at once
    flows = client.flows.list(per_page=50)
  2. Filter Results:

    Filtering
    # Use filters to reduce data
    flows = client.flows.list(status="running")
  3. Check Rate Limits:

    Check Rate Limits
    rate_limits = client.metrics.get_rate_limits()
    print(f"Rate limits: {rate_limits}")

Issue: Memory Usage

Symptoms: High memory usage with large datasets

Solutions:

  1. Process in Batches:

    Batch Processing
    def 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
  2. Use Generators:

    Generator Pattern
    def 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

Debug Logging
import logging

# Enable debug logging
logging.basicConfig(level=logging.DEBUG)

# Initialize client
client = NexlaClient()

Check SDK Version

Version Check
import nexla_sdk
print(f"SDK Version: {nexla_sdk.__version__}")

Test Basic Connectivity

Connectivity Test
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

Config Validation
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

  1. API Reference - Complete method documentation
  2. Examples & Tutorials - Working code examples
  3. Error Handling - Detailed error management

SDK Guides

  1. FAQ - Frequently asked questions
  2. Error Handling & Retries - Detailed error patterns
  3. 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

Pro Tip

When troubleshooting, always start with the simplest possible test case and gradually add complexity. This helps isolate the root cause of issues.