NodeJS suddenly stopped and can't start back up.

Everything was running fine with my NodeJS app. I woke up today to it just not working. Whenever I head to Monitoring or anything related to the app. it redirects me to a 500 error on fly.io. I’m not even sure where to start in diagnosing as the logs itself aren’t showing anything. I’ve tried pushing a new deploy, it was a success and finished deploying, but then I get this error:

could not find a good candidate within 90 attempts at load balancing. last error: no known healthy instances found for route tcp/443. (hint: is your app shutdown? is there an ongoing deployment with a volume or using the ‘immediate’ strategy? has your app’s instances all reached their hard limit?)

I’m quite stuck, as I have no idea what to even provide here.

Its worth noting that on my frontend, I also get an error for “CORS Failed” when it tries to fetch the data.

The first thing I would want to rule out is running out of memory:

The 500 error is likely coming from your app itself. Adding log statements to the endpoint you are hitting can help verify if the requests are making it to your app.

I’ve added some more memory. Though how do i view these log statements if I can’t even access monitoring? Everything works fine locally

I can’t even access my dashboard anymore without a 500 error.

Just to be clear, “my dashboard” is a part of your application, or do you mean Sign In · Fly ?

I’ll try logging the requests.

Although I literally changed nothing, and was working fine all along for the past few days.

Now it throws CORS failed errors. I never messed with any cors options, just the default app.use(cors())

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://reach-card.fly.dev/verify/a[REDACTED]?key=. (Reason: CORS request did not succeed). Status code: (null).

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://reach-card.fly.dev/verify/a[REDACTED]?key=. (Reason: CORS request did not succeed). Status code: (null).

Ok I console logged the first request. I redeployed and it worked? Then I removed the console log, redeployed now it doesn’t work? Added back the console log, redeployed, now it doesnt work anymore. Is this even an issue with my app. The only thing im changing is a console log at this point.

It says this as well

proxy sin [error]could not find a good candidate within 90 attempts at load balancing. last error: no known healthy instances found for route tcp/443. (hint: is your app shutdown? is there an ongoing deployment with a volume or using the ‘immediate’ strategy? has your app’s instances all reached their hard limit?)

If you ignore the fact that this is a rails app, you can see a similar error here: An error occurred during deployment.

In that case, the Rails app was dying (because of lack of memory) and fly could not find a healthy instance. I suspect that something similar is happening here, though the root cause no longer appears to be a lack of memory.

Have you tried running your Dockerfile locally?

I’m building locally, will let you know the results.

Runs fine locally.

Ok it is really weird. I keep trying to flyctl deploy, it worked, I ran it again, it doesnt work.

So is this fly’s fault?

At this point I don’t think we can rule anything in or out. I haven’t seen any logs or your app, so I’m limited at to what I can suggest. Perhaps we should approach this from the other direction: try running the following commands:

mkdir demo
cd demo
npx --yes @flydotio/node-demo@latest
fly launch
fly deploy

At this point you should have an app that works, and an app that (intermittently?) doesn’t. We’d just need to figure out what is different. If it helps, there is more information on how to evolve this app in various ways to make it more closely match yours: Vanilla with Candy Sprinkles · The Fly Blog

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.