massivedecks
massivedecks copied to clipboard
Heroku Build Version Won't Set
When using the deploy to heroku button, the build version on the website shows up as "unknown-dev" and when pushing locally to heroku after making changes or getting heroku to auto-build each new commit, the version visible on the website is “${MD_VERSION:-${SOURCE_VERSION:-unknown}-dev}”
Hrm, so the build does some very simple auto-population of the version using some sed
magic in NPM.
This relies on the SOURCE_VERSION
environment variable, which Heroku only appears to set when a build is created using automatic deploys. I see the same behaviour using the button. I'm not sure what a good fix for this is, honestly.
Dyno metadata might help this, but it is very heroku-specific and can't be automatically enabled from the deploy button.
I'm not sure why you see the latter result (when auto-deploying), it implies that for some reason you aren't getting the shell replacing environment variables, and I'm not sure what would cause that. I don't see that when using auto-deployment on Heroku.
Is this auto-deploying using a GitHub workflow or using Heroku's built in auto-deploy feature? I am using Heroku's built in feature, although I am wondering if a workflow would be easier.
So if I do a deploy from the button, leaving things as default, I get the "unknown-dev"
version as you did. If I then go to Heroku's deploy pane, choose github, connect it to this repository and hit "deploy branch", I see the correct version (this also works whenever I push to the repository).
It sounds like that is what you are doing, so I'm not sure what the difference is. Maybe it is a weird GitHub permissions thing with me being the owner of the repository? It seems highly unlikely to me that'd matter to getting the commit hash through to the build though.