Fix Netlify Deploy Preview Connection Issues Permanently (Issue #273)#274
Open
Om7035 wants to merge 3 commits into
Open
Fix Netlify Deploy Preview Connection Issues Permanently (Issue #273)#274Om7035 wants to merge 3 commits into
Om7035 wants to merge 3 commits into
Conversation
…uoteVote#273) - Standardized backend URL using REACT_APP_API_URL env var - Updated netlify.toml to default REACT_APP_API_URL to production - Cleaned up getServerUrl.js to remove regex guessing and enforce env var priority - Exposed REACT_APP_API_URL in vite.config.js
✅ Deploy Preview for quotevote ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…t statement - Fixed 'import' and 'export' may only appear at the top level error - Restored complete URL resolution logic with Netlify deploy preview support - Ensured all export statements are at the top level - Added proper environment variable handling for REACT_APP_SERVER and REACT_APP_API_URL - Improved error handling for localhost API URLs in remote environments
165afa4 to
8d4d408
Compare
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.
Root Cause
The "Connection Refused" error on Netlify Deploy Previews was caused by:
pr-{number}), which failed when the Railway PR environment wasn't available.localhostdefaults, causing connection errors on remote Netlify deployments.REACT_APP_API_URLvariable wasn't consistently available or prioritized in the build.Permanent Fix Strategy
We have moved from "guessing" to Explicit Configuration:
REACT_APP_API_URL: This is now the single source of truth.REACT_APP_API_URL = "https://api.quote.vote/graphql"to the build environment. This ensures every deploy (including previews) has a working backend connection to Production by default.REACT_APP_API_URL.localhostis detected on a remote environment.Files Changed
REACT_APP_API_URL.REACT_APP_API_URLto the client bundle.Manual Testing
.envvalues (localhost) are still respected (viaREACT_APP_API_URLor legacyREACT_APP_SERVER).https://api.quote.vote, solving the "Connection Refused" error.Assumptions
https://api.quote.vote.Fixes #273