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
Project ID:
ef987635-943c-471b-b185-cb7fa26305dc
its just a warning, your issue is something else, please provide your deploy logs https://bookmarklets.up.railway.app/log-downloader/
Github repos are https://github.com/Jack-Manning11/jukebox-backend for the backend and https://github.com/Jack-Manning11/jukebox for the front end
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.
https://github.com/brody192/create-react-app-starter
copy the Caddyfile and nixpacks.toml file from this repo into your frontend repo
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?
what status code do you get from that request?
if 503 then please read this https://docs.railway.app/guides/fixing-common-errors
I believe I configure that already according to the Node/express workflow they show
GitHub
jukebox-backend/index.js at main · Jack-Manning11/jukebox-backend
Contribute to Jack-Manning11/jukebox-backend development by creating an account on GitHub.
I'm assuming the error is coming from my front ends authorization but I don't know what the solution is
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
send me the domain for your backend please
https://jukebox-backend-production-dd99.up.railway.app
Thank you so much for the help!
I'm going to ask you to read this again, please carefully read it over and compare your code to the given example
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
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
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
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 frontendWhen trying to make a POST request I'm getting a 400 error, that means something is incorrect on my front end calls right?
are you sure you're using https when making these calls?
I'm pretty sure but after adding some console.logs to try and see more information my build failed
this would be an issue with your code, please read your build log
fixed the build log issue and back to the 400 error lol
well why does your backend say that the request was a bad request?
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".
show the code where you make the failing api request please
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]);hmmm not too sure, I think you could benefit from dinner debug logging, it would certainly help