R
Railwayβ€’2y ago
Zedas

React Express app in production thinks that it is in development?

Hi there, I am using process.env.NODE_ENV to determine the relative environment of my app between dev and prod. Yet for some reason, my app in production keeps tells me on a console.log() that it is in development thereby using the development url(localhost) while in production. I have added "production" as an environment variable in the railway env variables as well as added "node_env=production" to my build script. Though I believe that "npm run build" already sets "production" on default. It's fairly basic app currently and I thought I'd post here before I attempt StackOverflow πŸ˜† If you have any leads I would greatly appreciate it πŸ™
15 Replies
Percy
Percyβ€’2y ago
Project ID: 04753170-71db-45df-aab9-a9c3082c9230
Percy
Percyβ€’2y ago
⚠️ experimental feature
Zedas
ZedasOPβ€’2y ago
04753170-71db-45df-aab9-a9c3082c9230
Brody
Brodyβ€’2y ago
send the repo over and I'll have a look at it later tonight
Zedas
ZedasOPβ€’2y ago
GitHub
GitHub - IliaZolas/ramen
Contribute to IliaZolas/ramen development by creating an account on GitHub.
Zedas
ZedasOPβ€’2y ago
That’s the frontend Backend
Brody
Brodyβ€’2y ago
okay I'm quite busy today, so maybe someone else could help, or I will look at it later tonight
Zedas
ZedasOPβ€’2y ago
But I think the frontend is all you need to look at Take your time It is not urgent
Brody
Brodyβ€’2y ago
React App
Web site created using create-react-app
Brody
Brodyβ€’2y ago
Brody
Brodyβ€’2y ago
files changed/added: package.json and package-lock.json changed (added serve) added a .gitignore file to ignore the build folder since you shouldn't be committing the build folder to github. you do have build warning so you can set CI = false in your service variables (not the build command please), or just fix the warnings because they where nothing complicated for more information you can read my readme for a create-react-app railway template i put together https://github.com/brody192/create-react-app-starter/blob/main/README.md
Zedas
ZedasOPβ€’2y ago
Thanks Brody! Will take a look excellent, thanks again Brody, fastest support ever
Brody
Brodyβ€’2y ago
just a little reminder, you'll want to add the .gitignore file I provided in my zip file to your project and then delete the build folder in your repo, then the .gitignore file I provided will prevent the build folder from being pushed to your repo. we want railway to build your site and having a build folder already in your repo can cause issues down the line
Zedas
ZedasOPβ€’2y ago
Ooooooooooooooh ok thank you πŸ™
Brody
Brodyβ€’2y ago
no problem!
Want results from more Discord servers?
Add your server