Service variable is not being injected properly
and-cuau
HOBBYOP

9 months ago

index-DAuaLFn4.js:68 REACT_APP_API_URL: undefined

I console log REACT_APP_API_URL's value, a variable in my frontend service that I have set to the public url of the NodeJS server service but I get undefined.

REACT_APP_API_URL https://amiable-caring-production.up.railway.app

I don't understand why. The frontend is not reaching any of the backend routes because of this. I have redeployed several times.

EDIT: I ended up just hardcoding the URL within the react app itself, bypassing the service variable. Definitely not ideal though. Anyone know why service variables aren't being passed to the react program?

Solved$10 Bounty

2 Replies

and-cuau
HOBBYOP

9 months ago

I ended up just hardcoding the URL within the react app itself, bypassing the service variable.


and-cuau

I ended up just hardcoding the URL within the react app itself, bypassing the service variable.

9 months ago

Hey, can you show how you read the environment variable and what you are using to build your react app (for example vite)?


Status changed to Solved uxuz 9 months ago


Loading...