Skip to content

Wake Render backend directly from the browser - #23

Merged
xrpbanks merged 6 commits into
mainfrom
fix-browser-direct-backend-wakeup-v3
Aug 29, 2026
Merged

Wake Render backend directly from the browser#23
xrpbanks merged 6 commits into
mainfrom
fix-browser-direct-backend-wakeup-v3

Conversation

@xrpbanks

Copy link
Copy Markdown
Contributor

Summary

  • wake the sleeping Render backend with a direct, credential-free browser health probe
  • keep login, session, and private data requests on the same-origin frontend proxy
  • use the same reliable wake-up path for Xaman login and food search

Verification

  • 4 embedded-login regression tests pass
  • frontend lint passes
  • production build passes with NEXT_PUBLIC_BACKEND_WAKE_URL
  • remote branch files match the locally tested commit exactly

Added backend and health probe URLs for local development.
Removed unnecessary environment variables for clarity.
Add BACKEND_WAKE_BASE_URL for health probe requests.
Updated the backend wake base URL in tests and modified event logging to include the backend URL.
Copilot AI lite review requested due to automatic review settings August 29, 2026 21:33
@xrpbanks
xrpbanks merged commit e9ae4c9 into main Aug 29, 2026
5 checks passed

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

This PR introduces a dedicated “wake” base URL so the browser can directly probe the backend /health endpoint (without credentials) to wake a sleeping Render service, while keeping authenticated/private API traffic on the same-origin /api/backend proxy.

Changes:

  • Add NEXT_PUBLIC_BACKEND_WAKE_URL / BACKEND_WAKE_BASE_URL to support a direct browser health probe for warmup.
  • Update embedded Xaman login and food search flows to warm up via BACKEND_WAKE_BASE_URL before making application requests.
  • Update regression tests and .env.example to cover the new wake URL.

Reviewed changes

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

Show a summary per file
File Description
tools/tests/xaman_login_start_retry.test.mjs Updates module mocks/assertions to reflect the new wake URL parameter passed to waitForBackendReady.
frontend/lib/backendRequest.ts Adds BACKEND_WAKE_BASE_URL for browser-initiated warmup health probes.
frontend/components/XamanLoginPanel.tsx Switches embedded login warmup to use BACKEND_WAKE_BASE_URL before starting login.
frontend/components/FoodSearchPlaceholder.tsx Switches food search warmup to use BACKEND_WAKE_BASE_URL before querying foods.
frontend/.env.example Documents the new NEXT_PUBLIC_BACKEND_WAKE_URL environment variable for local/dev usage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +4 to +10
// Render may not wake one free service from another free service's proxy
// request. In production this public URL lets the browser wake the backend
// directly with the unauthenticated health probe; all application requests
// continue to use the same-origin proxy.
export const BACKEND_WAKE_BASE_URL =
process.env.NEXT_PUBLIC_BACKEND_WAKE_URL?.trim() || "/api/backend";

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants