Skip to content

fix(ai-proxy): log upstream error responses for better diagnostics#13657

Open
okaybase wants to merge 2 commits into
apache:masterfrom
okaybase:log-ai-proxy
Open

fix(ai-proxy): log upstream error responses for better diagnostics#13657
okaybase wants to merge 2 commits into
apache:masterfrom
okaybase:log-ai-proxy

Conversation

@okaybase

@okaybase okaybase commented Jul 3, 2026

Copy link
Copy Markdown
Member

Description

This PR adds error logging for upstream AI service responses in the ai-proxy plugin.

Problem:
When upstream AI services return error responses (non-2xx status codes), the current implementation returns the error to the client but doesn't log the upstream response details. This makes troubleshooting production issues difficult, as operators have no visibility into what the upstream service actually returned.

Solution:
Add a warning-level log entry that captures:

  • The HTTP status code from the upstream AI service
  • The error response body

This improves observability and helps diagnose issues like:

  • Upstream service outages or rate limiting
  • Authentication/authorization failures with AI providers
  • Invalid request format errors
  • API quota exhaustions

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. enhancement New feature or request plugin labels Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request plugin size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant