Skip to content

fix: Enhance admin API health check reliability and error handling#841

Merged
Avijit-Microsoft merged 4 commits into
devfrom
rc-bug-fix0605
May 7, 2026
Merged

fix: Enhance admin API health check reliability and error handling#841
Avijit-Microsoft merged 4 commits into
devfrom
rc-bug-fix0605

Conversation

@Ragini-Microsoft

Copy link
Copy Markdown
Collaborator

Purpose

This pull request improves the reliability and clarity of backend API health checks and the API proxying logic. It enhances the health check to better distinguish between valid backend responses and frontend fallback, and improves the server's error handling when the backend is misconfigured or unavailable.

Backend health check improvements:

  • The check_admin_api_health function now retries more times (8 instead of 5) with a longer delay (20s instead of 10s), and its docstring clarifies it also handles container restarts.
  • The health check now verifies that a 200 OK response from the admin API actually contains the expected JSON structure ({"status": "healthy"}), and logs warnings if the response is unexpected or if HTML is returned (which often means the frontend is serving a fallback instead of the backend). This helps catch misconfigurations where the backend is not properly connected.

API proxy and error handling improvements:

  • In server.js, the API proxy middleware setup is refactored for clarity, and a new handler is added: if BACKEND_URL is not set, API requests to /api now get a clear 503 error response instead of falling through to the frontend SPA, which would incorrectly return a 200 with index.html. [1] [2]

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Improves admin API health checks and /api proxy behavior to avoid false “healthy” signals and to return clearer errors when the backend is unreachable or not configured.

Changes:

  • Refactors /api proxy setup and returns a JSON 503 when BACKEND_URL is missing.
  • Strengthens admin API health check validation by verifying expected JSON payload vs. frontend HTML fallback.
  • Increases health check retry count and delay to better tolerate cold starts/container restarts.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/App/server/server.js Improves /api proxy wiring and adds explicit 503 JSON response when backend is not configured.
scripts/post_deploy.py Enhances health check robustness by validating response contents and increasing retry/backoff timing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/post_deploy.py
Comment thread scripts/post_deploy.py Outdated
Comment thread scripts/post_deploy.py
Comment thread src/App/server/server.js
@Ragini-Microsoft
Ragini-Microsoft marked this pull request as ready for review May 7, 2026 07:31
Copilot AI review requested due to automatic review settings May 7, 2026 07:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread scripts/post_deploy.py
@Avijit-Microsoft
Avijit-Microsoft merged commit 9c0e3a2 into dev May 7, 2026
16 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.5.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants