.env
REACT_APP_BASE_URL=https://mysite.azurewebsites.net/
.js
const baseUrl = process.env.REACT_APP_BASE_URL;
const url = `${baseUrl}WP/SiteLoginAPI/`;
console.log('Constructed URL:', url);
Problem
The constructed URL contains undefined, leading to a 404 error:
https://mysite.azurewebsites.net/undefinedWP/SiteLoginAPI/
What could be causing process.env.REACT_APP_BASE_URL to be undefined on the server, and how can I ensure it is correctly set?
It must be something simple that I’m just missing. But I haven’t been able to figure it out.
I found a similar question here but it also not helping.