Hi Render Community,
I have deployed a NodeJS/Express web service on Render and I am trying to implement a /healthcheck endpoint which also pulls the latest git version and commit timestamp using the following commands, but it is not working in Render. Although, it works successfully in my local environment.
try {
revision = require("child_process")
.execSync("git rev-parse --short HEAD")
.toString()
.trim();
} catch (error) {
logger.error(error);
revision = process.env.RENDER_GIT_COMMIT;
}
The above code results in the following output in Render logs
fatal: not a git repository (or any of the parent directories): .git
ERROR [2024-04-18 00:48:34] (57) Error: Command failed: git rev-parse --short HEAD
What am I missing here?