Hi I have configured a webservice on Render, which is built over node js, express and typescript.
I have set npm ci && npm run build
as build script, then npm run start
as starting script.
Logs seems ok during deployment but it stays at “in progress” status and eventualy finished in timeout. Until the timeout, my /health route can never be reached.
Below the scripts part of my package.json
"scripts": {
//...
"build": "rm -rf dist && tsc --build",
"start": "node dist/index.js",
//...
}
And below the code I run in order to launch the Express server:
const PORT = process.env.PORT || 8080;
const server = api.listen(PORT, "0.0.0.0", () => {
console.log(`Server running on port ${PORT}`);
});
I double checked, I have set at 10000
the PORT env var in my Render settings.
Below the code of my health route (well set in the webservice settings)
router.get("/health", (req, res) => {
const data = {
uptime: process.uptime(),
message: "Ok",
date: new Date(),
};
res.status(200).send(data);
});
Here my final logs from the deployment process:
==> Running build command 'npm ci && npm run build'...
added 197 packages, and audited 198 packages in 3s
37 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
> cb-api@1.0.0 build
> rm -rf dist && tsc --build
==> Uploading build...
==> Build uploaded in 7s
==> Build successful 🎉
==> Deploying...
==> Using Node version 20.17.0 via /opt/render/project/src/.nvmrc
==> Docs on specifying a Node version: https://render.com/docs/node-version
==> Using Bun version 1.1.0 (default)
==> Docs on specifying a bun version: https://render.com/docs/bun-version
==> Running 'npm run start'
> cb-api@1.0.0 start
> node dist/index.js
query: SELECT * FROM current_schema()
query: CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
query: SELECT version();
DB connected.
Server running on port 10000
==> Timed Out
In my Events tab, the final error message is:
Timed out after waiting for internal health check to return a successful response code at: buddj-api.onrender.com:10000 /health
Have you any idea of what is happening?