Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

GCP Cloud run issue

I get this error

Failed. Details: Revision 'cms-server-de-00002-8hg' is not ready and cannot serve traffic. The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable within the allocated timeout. This can happen when the container port is misconfigured or if the timeout is too short. The health check timeout can be extended. Logs for this revision might contain more information. Logs URL: Open Cloud Logging  For more troubleshooting guidance, see

{
"textPayload": "Default STARTUP TCP probe failed 1 time consecutively for container \"placeholder-1\" on port 8080. The instance was not started.\nConnection failed with status CANCELLED.",
"insertId": "682ecffe0009fb43d7415c09",
"resource": {
"type": "cloud_run_revision",
"labels": {
"service_name": "cms-server-de",
"project_id": "qvsu-449719",
"configuration_name": "cms-server-de",
"revision_name": "cms-server-de-00002-8hg",
"location": "asia-south1"
}
},
"timestamp": "2025-05-22T07:19:26.654147Z",
"severity": "ERROR",
"labels": {
"gcb-build-id": "b9cbd660-6448-461e-b04e-3ec0222c30ef",
"gcb-trigger-region": "global",
"gcb-trigger-id": "b9727979-c913-45bc-a9f3-dfac60a6a41a",
"managed-by": "gcp-cloud-build-deploy-cloud-run",
"commit-sha": "4991032a1229090692d9c7da9eb744bb8def3c45",
"instanceId": "007f65c6d2685990d369d8c49deac9dd20a3b2a53fbba25c3b1fcad6dca2281e7b4158a75533cb64c73baf00b77ab30f043815877d91af75b8e10825b7a1d04aae9e8f2ac8720d9d8856d8620dbc"
},
"logName": "projects/qvsu-449719/logs/run.googleapis.com%2Fvarlog%2Fsystem",
"receiveTimestamp": "2025-05-22T07:19:26.958243413Z"
}


here is my docker file 

FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .

FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app /app
ENV NODE_ENV=production
EXPOSE 8080
CMD ["node", "server.js"]

and here is my server.js file

const express = require('express');
const cors = require('cors');
const dotenv = require('dotenv');
const connectDB = require('./config/dbconnect');
const sendResponse = require('./utils/response');
const sendError = require('./utils/error');

const userRoutes = require('./routes/userRoutes'); // User APIs
const assetRegistryRoutes = require('./routes/assetRegistryRoutes'); // Asset Registry APIs
const authRouter = require('./routes/authRoutes'); // Auth APIs (login, logout)
const tokenRoutes = require('./routes/tokenRoutes'); // Token management APIs
const controlRegistryRoutes = require('./routes/controlRegistryRoutes'); // Control Registry APIs

dotenv.config();

const app = express();
const PORT = process.env.PORT;

// CORS configuration
app.use(cors({
origin: '*'
}));

// Middleware to parse JSON
app.use(express.json());

// Connect to MongoDB
connectDB();

// Health Check Route
app.get('/api/v1/health', (req, res) => {
try {
const healthInfo = {
status: 'UP',
timestamp: new Date(),
uptime: process.uptime(),
};
sendResponse(res, 200, 'Server is healthy', healthInfo);
} catch (err) {
sendError(res, 500, 'Something went wrong', err);
}
});

// Routes
app.use('/api/v1/auth', authRouter); // Login/Logout
app.use('/api/v1/users', userRoutes); // User management
app.use('/api/v1/assets', assetRegistryRoutes); // Asset registry
app.use('/api/v1/tokens', tokenRoutes); // Token listing/deletion
app.use('/api/v1/controls', controlRegistryRoutes); // Control registry

// Start Server
app.listen(PORT, () => {
console.log(`🚀 Server is running on port ${PORT}`);
});


someone help me to solve this question please

Solved Solved
0 4 243
1 ACCEPTED SOLUTION

Hi @dhfiubwdskvcs,

Based on the error log:

"Default STARTUP TCP probe failed 1 time consecutively for container \"placeholder-1\" on port 8080. The instance was not started.\nConnection failed with status CANCELLED."

It appears that your startup probe may be misconfigured. Please review your configuration to ensure that it is set up correctly. You can refer to this documentation for guidance on verifying and correcting your setup.

View solution in original post

4 REPLIES 4

Hi @dhfiubwdskvcs,

Welcome to Google Cloud Community!

Just to clarify—have you tried running the app locally on your machine? Does it start up and listen on port 8080 without issues? It could help narrow down if the problem is specific to Cloud Run or if there's something in the app's setup causing the issue.

You may also check this troubleshooting guide or try extending the health check timeout or adjusting the startup configuration as mentioned on the error message. 

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

 

hello @mcbsalceda 

# Use official Node.js 20 Alpine image
FROM node:20-alpine

# Set working directory inside container
WORKDIR /app

# Copy package files first to install dependencies
COPY package*.json ./

# Install only production dependencies (no devDependencies)
RUN npm install --production

# Copy the rest of your app source code
COPY . .

# Set NODE_ENV to production
ENV NODE_ENV=production

# Expose port 8080 (make sure your app listens on this port or reads it from env)
EXPOSE 8080

# Start the server with Node
CMD ["node", "server.js"]

so this is my docker file and yes in local docker desktop it is running perfectly on port 8080

Hi @dhfiubwdskvcs,

Based on the error log:

"Default STARTUP TCP probe failed 1 time consecutively for container \"placeholder-1\" on port 8080. The instance was not started.\nConnection failed with status CANCELLED."

It appears that your startup probe may be misconfigured. Please review your configuration to ensure that it is set up correctly. You can refer to this documentation for guidance on verifying and correcting your setup.

Thank you @mcbsalceda