Fixes · Deploys that break

Deploy fails its health check: the server always listens on port 5000

Replit apps listen on port 5000. Other hosts tell the app which port to use in PORT, so a fixed port is never reached and the deploy fails.

Most common in apps built with Replit.

What you see

The build succeeds, then the deploy times out or fails its health check, and the logs say the server started on port 5000.

Why it happens

Hosts give each app a port in the PORT environment variable and send traffic there. A server hard-coded to 5000 listens somewhere nobody calls.

How to fix it

  1. Change the server to listen on Number(process.env.PORT) || 5000, and deploy again.

Or ask your AI tool to fix it

Paste this into Lovable, Bolt, v0, Replit or Cursor, and let it make the change.

Make the server listen on the port in the PORT environment variable, falling back to 5000: Number(process.env.PORT) || 5000. Don't change anything else.

Don't change what the app does.
Never put a secret key or password in the code: read it from an environment variable.
If a step has to be done outside the code, like revoking a key in a provider's dashboard, list it for me at the end instead of skipping it.

How Launchpad helps

The launch check and the console's wizard both point at the line to change.

Check your app for this, freeJoin the waitlist

Related