HTTP Status Code Errors
400 Bad Request errors
400 Bad Request errors
Symptoms:
- Error response with status code 400
- Response body containing validation errors
- Client-side error messages about invalid data
-
Check request payload format:
-
Validate against API schema:
- Review the API documentation for required fields
- Check field types and constraints
- Use Pydantic validators for client-side validation
-
Check for missing required fields:
- Ensure all required fields are included
- Pay attention to nested objects and arrays
- Check for typos in field names
401 Unauthorized errors
401 Unauthorized errors
403 Forbidden errors
403 Forbidden errors
Symptoms:
- Error response with status code 403
- Message indicating βForbiddenβ or βInsufficient permissionsβ
- RBAC-related errors
-
Check user roles and permissions:
-
Verify endpoint permission requirements:
- Review API documentation for required permissions
- Ensure the authenticated user has the necessary role
-
Check organization/workspace access:
- Some endpoints require specific organization membership
- Verify the user belongs to the correct organization
-
Review role-based access control settings:
- Update user roles if necessary
- Check if permissions have changed in recent deployments
404 Not Found errors
404 Not Found errors
Symptoms:
- Error response with status code 404
- Message indicating βNot Foundβ or βResource not foundβ
-
Verify the API endpoint URL:
-
Check if the resource exists:
-
Examine resource permissions:
- Resource may exist but not be accessible to current user
- Check if resource belongs to a different organization
-
Check API version:
- Ensure youβre using the correct API version
- Some endpoints may be deprecated or moved
429 Too Many Requests errors
429 Too Many Requests errors
Symptoms:
- Error response with status code 429
- Message about rate limits or quotas
- Headers indicating rate limit information
- Response body containing βdetailβ: βToo many requestsβ
-
Implement exponential backoff:
-
Check for rate limit headers:
-
Optimize API usage:
- Batch requests when possible
- Cache responses to reduce API calls
- Implement request throttling on client side
-
Understand Definableβs rate limiting implementation:
500 Internal Server Error
500 Internal Server Error
Symptoms:
- Error response with status code 500
- Generic error messages in response
- Server-side exceptions
- Development mode: Detailed error with traceback information
- Production mode: Simple βInternal server errorβ message
-
Check server logs for details:
- Review application logs for exceptions
- Look for stack traces related to your request
- In development mode, examine the detailed error response
-
Report the issue with details:
-
Implement client-side error handling:
-
Check for recent deployments or changes:
- Recent code changes may have introduced bugs
- Infrastructure changes might affect API stability
-
Error structure in development mode:
Request/Response Issues
Serialization/deserialization errors
Serialization/deserialization errors
Symptoms:
- Error messages about invalid JSON
- Type errors when processing responses
- Fields missing or incorrectly formatted
-
Validate request data before sending:
-
Parse response data carefully:
-
Check for encoding issues:
-
Handle nullable fields:
- Use
None
for missing values - Implement default values for optional fields
- Use
CORS issues
CORS issues
Symptoms:
- Browser console errors about CORS policy
- Requests fail in browser but work in Postman
- Preflight requests failing
- βAccess-Control-Allow-Originβ missing or incorrect
-
Check the Origin header:
-
Verify Definableβs CORS configuration:
- Definableβs API allows all origins by default with β*β
- Credentials are allowed by default
- All methods and headers are allowed
-
For development, use a proxy:
-
Handle preflight requests:
- Complex requests trigger OPTIONS preflight
- Ensure server correctly responds to OPTIONS
- Check allowed headers and methods in response
-
Debug CORS issues:
Content type and encoding issues
Content type and encoding issues
Symptoms:
- βUnsupported Media Typeβ errors
- Character encoding problems in responses
- Binary data corruption
-
Set the correct Content-Type header:
-
Handle different response types:
-
For file uploads, use multipart/form-data:
-
Handle character encodings:
Authentication Issues
JWT token problems
JWT token problems
Symptoms:
- βToken expiredβ or βInvalid tokenβ errors
- βInvalid authorizationβ error message
- Frequent authentication failures
- Error message: βInvalid or expired tokenβ
- Status code 403 with JWT-related error messages
-
Implement proper token storage and refresh:
-
Check token payload and claims:
-
Implement token validation on client:
-
Handle clock skew issues:
- Server and client time differences can cause premature expiration
- Add a buffer time when checking expiration
- Consider using NTP to synchronize system clocks
-
Understand Definableβs JWT implementation:
OAuth integration problems
OAuth integration problems
Symptoms:
- OAuth flow redirects failing
- βInvalid clientβ or βInvalid redirect URIβ errors
- Access token exchange failures
-
Verify OAuth configuration:
- Double-check client ID and client secret
- Ensure redirect URI exactly matches the registered one
- Check scope parameters match required permissions
-
Debug OAuth flow:
-
Implement proper state validation:
-
Debug token exchange:
Integration Issues
API gateway and routing problems
API gateway and routing problems
Symptoms:
- βNo route matched with those valuesβ errors
- Unexpected 404 errors on valid endpoints
- Routing inconsistencies between environments
-
Check API gateway configuration:
- Verify routes and service mappings
- Check for path prefix issues
-
Trace request path:
-
Test endpoints directly vs. through gateway:
- Try accessing the service directly if possible
- Compare behavior through API gateway vs. direct
-
Check for trailing slash issues:
- Some routing configurations treat paths with/without trailing slashes differently
- Try both variations to identify the issue
Microservice communication errors
Microservice communication errors
Symptoms:
- Timeouts between services
- Incomplete data in responses
- Cascading failures
-
Implement circuit breakers:
-
Add proper timeouts:
-
Implement retry with backoff:
-
Monitor inter-service communication:
- Implement distributed tracing (Jaeger, Zipkin)
- Add correlation IDs to track requests across services
Performance Issues
API request timeouts
API request timeouts
Symptoms:
- Requests failing with timeout errors
- Long response times
- Client disconnections
-
Configure appropriate timeouts:
-
Break down large requests:
- Split large operations into smaller batches
- Implement pagination for large data sets
-
Consider asynchronous processing:
- For long-running operations, use a job-based approach
-
Use server-sent events or WebSockets for long operations:
- Maintain a single connection for updates
- Avoid repeated polling
Rate limiting and throttling
Rate limiting and throttling
Symptoms:
- 429 Too Many Requests errors
- Inconsistent API availability
- Batch operations partially succeeding
-
Implement client-side rate limiting:
-
Implement exponential backoff with jitter:
-
Batch requests appropriately:
- Group related operations to reduce API calls
- Use bulk endpoints when available
-
Monitor API usage and limits:
- Track rate limit headers in responses
- Schedule critical operations during low-usage periods