Port scan timeout reached, no open ports detected

I am experiencing an issue with my Node.js application deployment on Render. The deployment logs indicate a “Port scan timeout reached, no open ports detected” error, and my application is not able to start successfully. Below are the details:

Deployment Environment:

  • Service Name: isc-be-dev
  • Environment: Production
  • Instance Type: Free
  • Node.js Version: v18.19.1

Problem Description:

When deploying my application, it says ‘==> Your service is live :tada:’. But after that I consistently receive the following errors in the logs:

  • “No open ports detected, continuing to scan…”
  • “Port scan timeout reached, no open ports detected.”

After a series of these messages, the application crashes with the message “Killed - [nodemon] app crashed - waiting for file changes before starting…”

Application Details:

Here is a snippet of my server configuration:

import { cyan } from "colors";
import dotenv from "dotenv";
import { app } from "./app";
dotenv.config();

const port = process.env.PORT || 5000;

app.listen(port, () => {
  console.log(
    `Your server is up and running at: ${cyan(`http://localhost:${port}/`)}`,
  );
});

Screenshot:

Additional Information:

  • Nodemon Version: 3.0.2
  • TS-Node Version: 10.9.2

Request for Help:

I’m seeking assistance on how to resolve this port detection issue. Is there something I’m missing in my configuration? Any advice or troubleshooting steps would be greatly appreciated.

Thank you for your help!

Hi,

As a starting point, we don’t recommend using nodemon on Render. The platform is already monitoring your process.

“Killed” often implies an out-of-memory issue. Maybe try running ts-node with the --transpile-only option to try to reduce its memory footprint. Or transpile your TypeScript to JS in the build and run it with plain node.

While you mention the environment is production, there are many references to development tools and naming. Development tools/modes often use more memory than production mode, which may be the cause of the “Killed” message.

Hi, thank you for your guidance.

Solution Explanation

Previously, I used nodemon for development, which contributed to the problem.

Previous Scripts in package.json:

"scripts": {
  "dev": "cross-env NODE_ENV=development nodemon ./src/server.ts",
  "devback": "cross-env NODE_ENV=devback nodemon ./src/server.ts",
  "prod": "cross-env NODE_ENV=production node ./dist/server.js",
  "build": "tsc -p . && tsc-alias -p tsconfig.json"
}

Solution:

Now, I’ve removed nodemon from the Render deployment scripts, and updated scripts to build TypeScript into JavaScript and run with node.

Updated Scripts in package.json:

"scripts": {
 "dev_prod": "cross-env NODE_ENV=development node ./dist/server.js",
 "devback_prod": "cross-env NODE_ENV=devback node ./dist/server.js",
 "prod": "cross-env NODE_ENV=production node ./dist/server.js",
 "build": "tsc -p . && tsc-alias -p tsconfig.json",
},

Build and Start Command on Render:

  • Build Command: yarn build
  • Start Command: yarn dev_prod

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