Question

Deploy Error: Health Checks When deploying simple node js + express app

Hello, i am trying to deploy simple node js + express app.

server.js

const express = require('express');
const app = express();
const port = 3000; // Change this to the desired port number

// Set up a route for version information
app.get('/version', (req, res) => {
  const nodeVersion = process.version; // Node.js version
  const expressVersion = require('express/package.json').version; // Express version
  const versionInfo = {
    node: nodeVersion,
    express: expressVersion
  };
  res.json(versionInfo);
});

// Start the server
app.listen(port, () => {
  console.log(`Server listening on port ${port}`);
});

package.json

{
  "name": "webhook",
  "version": "1.0.0",
  "description": "Your application description",
  "main": "server.js",
  "scripts": {
    "start": "node server.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/xxx/xxx.git"
  },
  "keywords": [],
  "author": "Your Name",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/xxx/xxxs"
  },
  "homepage": "https://github.com/xxx/xxxe",
  "dependencies": {
    "express": "^4.18.2"
  },
  "devDependencies": {}
}

I am getting this error

Deploy Error: Health Checks Component Issues failed to deploy

Attaching the screenshot of deploy log and error error log

image alt text
image caption
image alt text
image caption

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I try to set the port to 3000 I am getting this error

image alt text
image caption

i tried to change the port to 3001 in my code.

I still get same error Deploy Error: Health Checks

This comment has been deleted

    Bobby Iliev
    Site Moderator
    Site Moderator badge
    July 6, 2023

    Hi there,

    It looks like that your app is listening on port 3000. This should also be the health check port, can you confirm if this is the case?

    What you could do is:

    • Go your DigitalOcean Control Panel
    • Click on Apps on the left menu
    • Click on your app
    • Then go to settings
    • Click on the Node.js component that you’ve deployed
    • Then go to health checks and set the type to TCP and the port to 3000

    After that save the settings and give it another try.

    Let me know how it goes!

    Best,

    Bobby

    Try DigitalOcean for free

    Click below to sign up and get $200 of credit to try our products over 60 days!

    Sign up

    Featured on Community

    Get our biweekly newsletter

    Sign up for Infrastructure as a Newsletter.

    Hollie's Hub for Good

    Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

    Become a contributor

    Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

    Welcome to the developer cloud

    DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

    Learn more
    DigitalOcean Cloud Control Panel