Skip to main content
coding intermediate

Debug Network Request Failures

Systematically troubleshoot API calls, HTTP requests, and network issues with this comprehensive debugging prompt for developers.

Works with: chatgptclaudegemini

Prompt Template

You are an expert network debugging specialist. I need help troubleshooting a network request failure. Please analyze the following information systematically and provide a comprehensive debugging strategy. **Request Details:** - URL/Endpoint: [REQUEST_URL] - HTTP Method: [HTTP_METHOD] - Request Headers: [REQUEST_HEADERS] - Request Body/Payload: [REQUEST_BODY] - Expected Response: [EXPECTED_RESPONSE] **Error Information:** - Error Message/Code: [ERROR_MESSAGE] - Response Status Code: [STATUS_CODE] - Response Headers: [RESPONSE_HEADERS] - Response Body: [RESPONSE_BODY] - Environment: [ENVIRONMENT] - Programming Language/Framework: [LANGUAGE_FRAMEWORK] **Additional Context:** - When did this start failing: [FAILURE_TIMELINE] - What changed recently: [RECENT_CHANGES] - Does it work in other environments: [OTHER_ENVIRONMENTS] Please provide: 1. **Initial Analysis**: What the error likely indicates and potential root causes 2. **Systematic Debugging Steps**: A prioritized checklist of things to verify, from most likely to least likely causes 3. **Diagnostic Commands/Tools**: Specific commands, tools, or code snippets to gather more information 4. **Common Solutions**: Step-by-step fixes for the most probable causes 5. **Prevention Strategies**: How to avoid similar issues in the future 6. **Escalation Path**: When and how to escalate if basic troubleshooting doesn't resolve the issue Format your response clearly with actionable steps I can follow immediately.

Variables to Customize

[REQUEST_URL]

The full URL or API endpoint being called

Example: https://api.example.com/v1/users/123

[HTTP_METHOD]

The HTTP method being used

Example: POST

[REQUEST_HEADERS]

Headers sent with the request

Example: Content-Type: application/json, Authorization: Bearer abc123

[REQUEST_BODY]

The request payload or parameters

Example: {"name": "John Doe", "email": "john@example.com"}

[EXPECTED_RESPONSE]

What response you expected to receive

Example: 200 OK with user creation confirmation

[ERROR_MESSAGE]

The specific error message or code received

Example: Connection timeout after 30 seconds

[STATUS_CODE]

HTTP status code returned (if any)

Example: 504 Gateway Timeout

[RESPONSE_HEADERS]

Headers received in the response

Example: Server: nginx/1.18.0, Content-Type: text/html

[RESPONSE_BODY]

The actual response body received

Example: Gateway timeout error - upstream server failed to respond

[ENVIRONMENT]

The environment where the failure occurs

Example: Production environment, AWS us-east-1

[LANGUAGE_FRAMEWORK]

Programming language and framework being used

Example: Node.js with Express and Axios

[FAILURE_TIMELINE]

When the issue started occurring

Example: Started failing 2 hours ago, was working fine yesterday

[RECENT_CHANGES]

Any recent changes to code, infrastructure, or configuration

Example: Updated API client library from v2.1 to v3.0 this morning

[OTHER_ENVIRONMENTS]

Whether it works in other environments

Example: Works fine in staging environment, only fails in production

Example Output

## Initial Analysis The 504 Gateway Timeout error indicates that your application successfully reached the API gateway/load balancer, but the upstream server (actual API server) failed to respond within the timeout window. This is typically an infrastructure or server-side issue rather than a client-side problem. ## Systematic Debugging Steps 1. **Verify API Server Status**: Check if the target API service is operational 2. **Test Connectivity**: Confirm network connectivity to the endpoint 3. **Examine Load Balancer**: Check if load balancer/gateway is properly routing requests 4. **Review Timeout Settings**: Verify client and server timeout configurations 5. **Check Server Resources**: Monitor CPU, memory, and disk usage on API servers 6. **Analyze Request Patterns**: Look for traffic spikes or unusual request volumes ## Diagnostic Commands/Tools ```bash # Test basic connectivity curl -v https://api.example.com/v1/users/123 # Check DNS resolution nslookup api.example.com # Test with longer timeout curl --max-time 60 https://api.example.com/v1/users/123 ``` ## Common Solutions 1. **Increase timeout values** in your HTTP client configuration 2. **Retry logic**: Implement exponential backoff for failed requests 3. **Health check**: Contact your API provider about server status 4. **Alternative endpoint**: Test with a simpler endpoint to isolate the issue ## Prevention Strategies - Implement circuit breaker patterns - Set appropriate timeout values - Add comprehensive logging and monitoring - Use health check endpoints for proactive monitoring

Pro Tips for Best Results

  • Always test with curl or Postman first to isolate whether it's a code issue or API issue
  • Include timestamps and request IDs in your debugging information to help trace requests
  • Check your API provider's status page and documentation for known issues
  • Save working request examples for comparison when troubleshooting failures
  • Implement proper logging to capture request/response details for future debugging

Tags

Want 500+ Expert Prompts?

Get the Premium Prompt Pack — organized, tested, and ready to use.

Get it for $29

Related Prompts You Might Like