Node.js App starting but not responding?

I have an app running and I’m making significant changes to it so I created a new app and I’m trying to get that up and running. Everything runs fine locally it’s just when I deploy to fly I’m getting an ERROR 502 (after waiting quite some time).

The app is logging healthcheck requests, though those don’t seem to be working right either. And if I navigate to the healthcheck endpoint I get a 502 there as well.

Here’s the log output on startup:

2022-10-21T23:12:50Z app[0450c2b2] den [info]Starting init (commit: 249766e)...
2022-10-21T23:12:50Z app[0450c2b2] den [info]Mounting /dev/vdc at /data w/ uid: 0, gid: 0 and chmod 0755
2022-10-21T23:12:50Z app[0450c2b2] den [info]Preparing to run: `sh start.sh` as root
2022-10-21T23:12:50Z app[0450c2b2] den [info]2022/10/21 23:12:50 listening on [fdaa:0:23df:a7b:d827:2:6f19:2]:22 (DNS: [fdaa::3]:53)
2022-10-21T23:12:50Z app[0450c2b2] den [info]+ npx prisma migrate deploy
2022-10-21T23:12:51Z app[0450c2b2] den [info]Prisma schema loaded from prisma/schema.prisma
2022-10-21T23:12:51Z app[0450c2b2] den [info]Datasource "db": SQLite database "sqlite.db" at "file:/data/sqlite.db"
2022-10-21T23:12:51Z app[0450c2b2] den [info]2 migrations found in prisma/migrations
2022-10-21T23:12:51Z app[0450c2b2] den [info]No pending migrations to apply.
2022-10-21T23:12:52Z app[0450c2b2] den [info]+ npm run start
2022-10-21T23:12:52Z app[0450c2b2] den [info]> kentcdodds.com@1.0.0 start
2022-10-21T23:12:52Z app[0450c2b2] den [info]> cross-env NODE_ENV=production node --require ./node_modules/dotenv/config ./index.js
2022-10-21T23:12:55Z app[0450c2b2] den [info]Express server listening on port 8080
2022-10-21T23:12:55Z app[0450c2b2] den [info]prisma:info Starting a sqlite pool with 3 connections.
2022-10-21T23:13:04Z app[0450c2b2] den [info]prisma:query - 52ms - SELECT COUNT(*) FROM (SELECT `main`.`PostRead`.`id` FROM `main`.`PostRead` WHERE 1=1 LIMIT ? OFFSET ?) AS `sub`
2022-10-21T23:13:09Z app[0450c2b2] den [info]GET /healthcheck - - - - ms
2022-10-21T23:13:24Z app[0450c2b2] den [info]GET /healthcheck - - - - ms
2022-10-21T23:13:39Z app[0450c2b2] den [info]GET /healthcheck - - - - ms
2022-10-21T23:13:54Z app[0450c2b2] den [info]GET /healthcheck - - - - ms
2022-10-21T23:14:09Z app[0450c2b2] den [info]GET /healthcheck - - - - ms
2022-10-21T23:14:24Z app[0450c2b2] den [info]GET /healthcheck - - - - ms
2022-10-21T23:14:39Z app[0450c2b2] den [info]GET /healthcheck - - - - ms
... continues

Any ideas?

For anyone at Fly, the app is called kcd-staging and the code is in the dev branch on GitHub - kentcdodds/kentcdodds.com: My personal website

Hey - as a first step, I’d try to SSH in via fly ssh console and see if anythings running vis something like these commands (if they are available):

# see running processes
ps aux

# check requests, i’m assuming the port here 
curl localhost:8080

Thanks. Those commands are not available unfortunately. But I know that the server is running and receiving requests because of the logs. It’s just struggling to respond for some reason. I’ll keep digging.

If your image is Debian based, you can install both with:

apt-get update
apt-get install procps curl

Ok, so my home page does a ton of work which is cached after the work is done, but it never gets a chance to get cached before the request times out. So I’m working out a way to work around that.

1 Like

I figured this one out. It’s a long story. It was my own fault. Feel free to watch this if you’re interested: EpicWeb.dev Live stream 🌌 Finish deploying LiteFS on Fly - YouTube

1 Like