Debug SDK issues with built-in logging and monitoring tools
The SDK provides debugging tools to help you troubleshoot issues and monitor API interactions during development.
Enable detailed logging for development and troubleshooting:
Implement custom logging for production monitoring:
The SDK provides utilities for working with Response objects:
Monitor request duration in your application:
Monitor SDK memory usage:
Token refresh loops
Problem: Infinite token refresh attempts
Solution: Check token storage and refresh token validity
Cross-tab token sync issues
Problem: Tokens not syncing between browser tabs
Solution: Use BrowserTokenStorage which automatically syncs via localStorage
CORS errors
Problem: Cross-origin request blocked
Solution: Verify your domain is allowlisted with Commerce Engine support
Network timeouts
Problem: Requests timing out
Solution: Configure appropriate timeout and check network conditions
Always enable debug mode during development to catch issues early
Track error patterns and response times to identify performance issues
Set reasonable timeouts based on your applicationβs needs and network conditions
Create custom loggers for different environments and monitoring requirements
The debugging features help you understand SDK behavior during development. For production applications, implement appropriate monitoring and error tracking to maintain visibility into API performance.