npm WARN config production Use `--omit=dev` instead.

I'm receiving this error and it is preventing my app from launching at all. Project Id: ef987635-943c-471b-b185-cb7fa26305dc. This is my first time deploying a site and feeling a bit lost, does anybody know how to fix this?
28 Replies
Percy
Percy12mo ago
Project ID: ef987635-943c-471b-b185-cb7fa26305dc
Brody
Brody12mo ago
its just a warning, your issue is something else, please provide your deploy logs https://bookmarklets.up.railway.app/log-downloader/
JackManning
JackManningOP12mo ago
GitHub
GitHub - Jack-Manning11/jukebox-backend
Contribute to Jack-Manning11/jukebox-backend development by creating an account on GitHub.
GitHub
GitHub - Jack-Manning11/jukebox: Jukebox interface for the spotify API
Jukebox interface for the spotify API. Contribute to Jack-Manning11/jukebox development by creating an account on GitHub.
Brody
Brody12mo ago
https://github.com/brody192/create-react-app-starter copy the Caddyfile and nixpacks.toml file from this repo into your frontend repo
JackManning
JackManningOP12mo ago
That seemed to fix that issue but I'm running into a CORS error. "Access to XMLHttpRequest at 'https://jukebox-backend-production-dd99.up.railway.app/login' from origin 'https://jukebox-production.up.railway.app' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource." But my Node server is using CORS. I tried manually setting the headers and specifying the origin but that didn't fix it. Any chance you know how to fix that error?
Brody
Brody12mo ago
what status code do you get from that request? if 503 then please read this https://docs.railway.app/guides/fixing-common-errors
JackManning
JackManningOP12mo ago
I believe I configure that already according to the Node/express workflow they show
JackManning
JackManningOP12mo ago
GitHub
jukebox-backend/index.js at main · Jack-Manning11/jukebox-backend
Contribute to Jack-Manning11/jukebox-backend development by creating an account on GitHub.
JackManning
JackManningOP12mo ago
I'm assuming the error is coming from my front ends authorization but I don't know what the solution is
JackManning
JackManningOP12mo ago
This is the new error I'm receiving. POST https://jukebox-production.up.railway.app/login 405 (Method Not Allowed)
Breakup Jukebox
Jukebox interface for the Spotify API
Brody
Brody12mo ago
send me the domain for your backend please
JackManning
JackManningOP12mo ago
Brody
Brody12mo ago
I'm going to ask you to read this again, please carefully read it over and compare your code to the given example
JackManning
JackManningOP12mo ago
I thought i did... I'm no longer running into that screen or getting a 503. I added in the const PORT = process.env.PORT || 3001; and have my app listening with app.listen("0.0.0.0", err => { if(err) { console.log(err); } console.log("Listening on port: ", PORT); }). I'm sorry if I'm missing something obvious but I don't see anything else on that documentation that would solve the CORS error I'm getting
Brody
Brody12mo ago
the cors error is the least of your worries, please visit this link in the browser and you will get a 503 and you are missing something obvious, but I'd prefer for you to come to what you're missing on your own, builds up a better problem solving ability so again, please look carefully at your code and the node code this docs page provides
JackManning
JackManningOP12mo ago
Ok I believe I found that error, thanks for the guidance but making me work, my app.listen line was not configured correctly. However I'm receiving a 404 error when navigating to my backend url and not a 503
Brody
Brody12mo ago
404 is so much better than 503, and doesn't always mean something is wrong, you might just not have a route for / registered, Which is totally normal for an API now try making api calls to the backend with the frontend
JackManning
JackManningOP12mo ago
When trying to make a POST request I'm getting a 400 error, that means something is incorrect on my front end calls right?
Brody
Brody12mo ago
are you sure you're using https when making these calls?
JackManning
JackManningOP12mo ago
I'm pretty sure but after adding some console.logs to try and see more information my build failed
Brody
Brody12mo ago
this would be an issue with your code, please read your build log
JackManning
JackManningOP12mo ago
fixed the build log issue and back to the 400 error lol
Brody
Brody12mo ago
well why does your backend say that the request was a bad request?
JackManning
JackManningOP12mo ago
I'm not entirely sure. The backend is still saying it cannot GET with a 404 error and the POST login request is saying its bad and xhr.js:256 XHR failed loading: POST "https://jukebox-backend-production-dd99.up.railway.app/login".
Brody
Brody12mo ago
show the code where you make the failing api request please
JackManning
JackManningOP12mo ago
const useAuth = (code) => { const [accessToken, setAccessToken] = useState(); const [refreshToken, setRefreshToken] = useState(); const [expiresIn, setExpiresIn] = useState(); useEffect(() => { (async () => { try { const { data: { access_token, refresh_token, expires_in }, } = await axios.post(https://jukebox-backend-production-dd99.up.railway.app/login, { code, }); setAccessToken(access_token); setRefreshToken(refresh_token); setExpiresIn(expires_in); window.history.pushState({}, null, '/'); } catch (error){ console.log("Error: ", error); //window.location = '/'; } })(); }, [code]);
Brody
Brody12mo ago
hmmm not too sure, I think you could benefit from dinner debug logging, it would certainly help
Want results from more Discord servers?
Add your server