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.
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
Is your service a Docker service? If so unless you copy the .git directory to your image, you will not have a Git repo within in your service. Is there any reason you don’t just use RENDER_GIT_COMMIT?