Backend Crashing
djugovic2003
FREEOP

8 months ago

Backend instantly crashing when I deploy the build. First time trying to make an app and honestly vibe coded the project. Any ideas normally when a backend just loads up and crashes right away? I checked all the .env vairables and they are the same as when I was testing locally and it was working. I changed all my frontend api's to point at my backend in railway so I'm not sure what the issue is.

$10 Bounty

45 Replies

djugovic2003
FREEOP

8 months ago

dc359f09-862c-4aae-a39f-43a221698246


8 months ago

seems like it runs for at least a few seconds before crashing. More logging would be helpful


8 months ago

What stack is it? Can you share a repo?


djugovic2003
FREEOP

8 months ago

Sure. I'm new to all this and my repo is private on github. Am I able to add you as a collaborator or do I need to make it public. Using Node.js, express.js, MongoDB, React Native


djugovic2003
FREEOP

8 months ago

idk if its considered part of the stack but using Nodemailer and JWT


djugovic2003
FREEOP

8 months ago

This is the only request the backend is receiving and its failing

1392700257804222700


djugovic2003
FREEOP

8 months ago

I think I have updates but I don't want to send too much before you respond


8 months ago

Send as much as you want!


djugovic2003
FREEOP

8 months ago

so I turned on the replica and I saw that the container stopping was actually the past replica and the newest instance I believe hasn't crashed and is still going


8 months ago

making your repo public would be best. I likely won’t be the one helping you out with this, but I’m teeing up the thread for someone else to solve.


djugovic2003
FREEOP

8 months ago

so its just the fact that I can't actually do anything in the app like I put with the http requests not working I've just been looking it up and since I'm using nodemailer would gmail be blocking the login from railway even though I'm using an app password and maybe thats what's causing this?


djugovic2003
FREEOP

8 months ago

I am not that knowledgable but I at least think that the last picture I sent means my backend is receiving the request from my frontend then something is happening after that


8 months ago

502 is a timeout, your app seems to be processing the request without returning an error code. this usually happens when your code crashes ungracefully after receiving a request


8 months ago

Adding more logging is what you need to do at this point


djugovic2003
FREEOP

8 months ago

I don't know if I just don't know where the logging is or whatnot but I've tried to add console logging and still my logs only say what I've sent


djugovic2003
FREEOP

8 months ago

also I made my repo public : https://github.com/djugovic2003/AddLife


djugovic2003
FREEOP

8 months ago

like this is where the logging would be right?

1392703408401547300


8 months ago

yes, any console.log() calls your app makes will show up there


8 months ago

Seems like your app is crashing on startup. Starting by adding logging to whatever processes it runs when starting is a good first step


djugovic2003
FREEOP

8 months ago

I got no idea the console logs all logged up until after it start it won't send a single request to the express app tho so idk whats going on. backend is listening on port 8080. the container is running and not crashing. No logs from route handlers. 502 errors for all requests in http logs with long timeouts. IDK is it a deployment/platform config issue. This is my first time trying to deploy an app so maybe I did something wrong or didn't do something altogether. Not sure what to try

1392710899281825800


djugovic2003
FREEOP

8 months ago

I'm going to sleep though hopefully someone much smarter than I will fix this tomorrow 😄


8 months ago

Looks like the container was stopped, that means it crashed. More logs! What happened 6 seconds after connecting to MongoDB?


djugovic2003
FREEOP

8 months ago

you see the replica tho? Thats the old container stopping


djugovic2003
FREEOP

8 months ago

the new instance never stopped it appears so it doesn't seem like its crashing its just not processing any requests


8 months ago

Ah my mistake, I see that now


8 months ago

Best to turn off replicas for now. That’s just complicating the logging and which service your requests are getting sent to. Simplify the problem so it can be solved easier, then you can add replicas back


djugovic2003
FREEOP

8 months ago

Yeah I just turned them on and noticed it was a different replica stopping because it was there whether I had replicas clicked or not


djugovic2003
FREEOP

8 months ago

Or do you mean should I go to the specific build log for my most current build so I don’t see any of the old stuff


8 months ago

for now, turn off replicas until we get your problem fixed


djugovic2003
FREEOP

8 months ago

okay thank you for the help do you have any idea the sort of timeline these tidkcets are fixed at


djugovic2003
FREEOP

8 months ago

wow took way too many hours for that to be the issue I figured htat one out I think

1392926749251211300


djugovic2003
FREEOP

8 months ago

I am curious about it sending so many api requests to there though


djugovic2003
FREEOP

8 months ago

the 4 GET requests


8 months ago

This is not a ticket for the team, this is community support. Given that this is a code issue, not a platform issue, we will not be raising this to the team


8 months ago

It’s extremely possible that your frontend (that I’m assuming you vibe coded as well?) is double sending requests


djugovic2003
FREEOP

8 months ago

ah I see I thought this was team tickets


djugovic2003
FREEOP

8 months ago

lmao hell yeah vibe coded to the max


djugovic2003
FREEOP

8 months ago

I believe it is sending double requests as well working on fixing it


8 months ago

that’s what happens when you vibe code lol


8 months ago

gotta pay attention to what you’re “coding” otherwise you’ll be lost


djugovic2003
FREEOP

8 months ago

lol true I need it to help me learn though


djugovic2003
FREEOP

8 months ago

I'm not a computer science major or anything just trying to learn


8 months ago

When using AI, you learn general concepts, not how to code. You might learn how to debug, but you won't learn how to write your own code


8 months ago

It's not a learning tool, you're skipping many many foundational steps


djugovic2003
FREEOP

8 months ago

yah i'm taking some cs courses here in the future to actaully learn how to code right now I'm just learning about how everything interacts in app making and getting familiar with the different softwares


Loading...