Wake Render backend directly from the browser - #23
Merged
Conversation
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.
Contributor
There was a problem hiding this comment.
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_URLto support a direct browser health probe for warmup. - Update embedded Xaman login and food search flows to warm up via
BACKEND_WAKE_BASE_URLbefore making application requests. - Update regression tests and
.env.exampleto 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"; | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verification