Search code examples
node.jsherokucoffeescriptbuildpack

Cedar-14 incompatibility using coffeescript in heroku node.js app with custom buildpack from aergonaut


I'm using this custom buildpack with my heroku node.js app, in order to write my app in coffeescript. Using the classic cedar stack, everything has been working fine for over a year. But that stack is scheduled to be deprecated in November 2015, in favor of the Cedar-14 stack.

I followed the upgrade instructions, and when I pushed my app to heroku (without any code changes), the custom build pack doesn't work properly, during the compile phase. Specifically, it fails to detect the version of node.js my app depends on, and defaults it to 0.4.7, which is too old, and my app and heroku won't work with that version.

Here's the output from the compile phase:

$ git push heroku HEAD:master
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 635 bytes | 0 bytes/s, done.
Total 7 (delta 6), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Fetching custom git buildpack... done
remote: -----> Coffeescript app detected
remote: -----> Resolving engine versions
remote:
remote:        WARNING: No version of Node.js specified in package.json, see:
remote:        https://devcenter.heroku.com/articles/nodejs-versions
remote:
remote:        WARNING: The default version of Node.js and npm on Heroku will begin
remote:        tracking the latest stable release starting September 1, 2012.
remote:
remote:        Using Node.js version: 0.4.7
remote:        Using npm version: 1.0.106

My package.json lists the node version correctly, and that has been working with the cedar stack just fine:

  "engines": {
    "node": "0.10.x",
    "npm": "1.3.x"
  }

This is the line of code in the custom build pack that attempts to determine the node version. And when I emulate that manually, it works just fine. But when this detection happens during the push to heroku, it fails.

$ cat package.json | node /usr/local/bin/json engines.node
0.12.x

Heroku's guidelines seem to suggest that buildpacks have to specifically support the new cedar-14 stack: here. But I fail to see what's wrong with this custom build pack I'm using.


Solution

  • Spoke with Chris Fung about this - the original author of the custom buildpack in question, and he suggested rebasing his buildback to the latest nodejs official Heroku buildpack. I did that in my own fork of the repo.

    And then I changed the stack of my coffeescript app to Cedar-14, and changed the buildpack to this new one. All works now.

    $ heroku buildpacks:set https://github.com/sailrish/heroku-buildpack-coffee
    $ heroku stack:set cedar-14
    $ git push heroku master