Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A "double rainbow" deploy is when someone is using the same buildpack twice. Normally this is by accident. There are failure conditions defined in #511 the app has to have a
json
gem and a version of Ruby that is different from the version of Ruby being used by the buildpacks.When this happens, this exception will occur when the second buildpack tries to execute:
If you look at the output, the failure is happening extremely early, this indicated that it was happening before any significant code had been run, otherwise we would have expected to see
The exception only occurred when using
v155
of the buildpack as the second buildpack (viaheroku buildpacks:add
).Here's what was happening: The first buildpack runs and installs the app's
json
gem. The buildpacks are designed so that they make their contents available for the next buildpack. I.e. if you installnode
via a buildpack, then the next buildpack to execute is expected to havenode
on thePATH
. The same is true of ruby and any gems installed.So now the second buildpack executes. To do this it's own source code is loaded into memory, when it does this it hits a
require "json"
call that was introduced inv155
and tries find thejson
library. While this library ships with Ruby it is also a gem, if the gem is present on the system it will prefer the gem. So it loads thejson
gem from a different version of Ruby that is currently executing, it can't because the symbols are different, it errors out.We can avoid this completely by not loading the
json
library, instead we can vendor in https://github.com/kr/okjson.