5 year Heroku Update
Once there was a wedding. Since it was my wedding, it needed puzzles. I was trying out the heroku api at the time, so all these things game together to make:
Which has been great, heroku’s free tier only runs my site on the very rare occasions I remember and want to show someone. Cheap as cold stored bits, which is in this case means free.
But in 2020, heroku shut down the base image for these 5 year old images, and 20 reminder emails later, I have a quick cleanup chore to do.
So what did it actually entail?
-
Re-installing heroku on my machine.
-
heroku git:clone
to download the old version.As an aside, the heroku model is pretty sweet - rather than introducing a new mental model, it provides a git remote. So a code push is a deploy and can check inline for issues.
-
Run locally - which means installing nodejs, and
npm install
to pull dependencies -
Npm audit gives helpful feedback that several libraries needed updates, and the rendering tool jade was now renamed to Pug. Coolcoolcool
-
Jade to pug. This was a one-line change for the express template engine
app.set('view engine' 'pug')
then renaming several files from
*.jade
to*.pug
(the contents didn’t change at all). -
Finally able to test locally,
heroku local
acting as the simulator. -
Then using heroku push to re-deploy, I ran into two issues. One was the reason I started, I needed to change the stack to one that was still supported.
heroku stack:set heroku-20 -a
-
And this last unexpected issue
remote: -----> Installing binaries
remote: engines.node (package.json): 0.10.x
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 0.10.x...
remote: Downloading and installing node 0.10.48...
remote: Detected package-lock.json: defaulting npm to version 5.x.x
remote: Bootstrapping npm 5.x.x (replacing 2.15.1)...
remote: npm 5.x.x installed
remote:
remote: /tmp/build_11319857/.heroku/node/lib/node_modules/npm/bin/npm-cli.js:79
remote: var notifier = require('update-notifier')({pkg})
Long story short, the 5 year old project configured one version of nodejs. Heroku tried to use it, but combined that with the latest build of npm. That mismatch meant new libraries loading in the old interpreter, so sadness all around.
The fix: update the node version from 0.10.x to 12.x
and tada! a working website that I might leave be for a few years more. :-)