massivedecks icon indicating copy to clipboard operation
massivedecks copied to clipboard

Heroku Build Version Won't Set

Open lhvy opened this issue 4 years ago • 3 comments

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}”

lhvy avatar Apr 05 '20 23:04 lhvy

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.

Lattyware avatar Apr 06 '20 10:04 Lattyware

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.

lhvy avatar Apr 06 '20 23:04 lhvy

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.

Lattyware avatar Apr 07 '20 00:04 Lattyware