Fixing an issue with Sprockets and feature tests
A fix we found for issues with the asset pipeline on CircleCI
I’ve just encountered a strange issue which I thought was worth writing about.
We have Dependabot on a lot of our projects and had two PRs raised, one to upgrade Rails from version 6.0.0
to 6.0.1
and active_storage_validations from 0.8.3
to 0.8.4
. Locally my test suite was passing but my CircleCI build was failing, with the following error when my feature specs were running:
[SassC::FunctionsHandler] undefined method `[]' for nil:NilClass
[SassC::FunctionsHandler] undefined method `[]' for nil:NilClass
Viewing one users articles (FAILED - 1)
/home/circleci/repo/vendor/bundle/ruby/2.6.0/gems/sassc-2.1.0-x86_64-linux/lib/sassc/engine.rb:42: [BUG] Segmentation fault at 0x0000000000000000
ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-linux]
This initially caused me to believe that sassc-rails was the issue. After searching for similar failures online and looking through the open PRs on this repo I came up empty handed.
After googling this specific part of the error: sassc-2.2.1/lib/sassc/engine.rb:42: [BUG] Segmentation fault at 0x0000000000000000
I got one result which yielded a fix for me! There appears to be an issue with sprockets 4.0.0
. I’ve downgraded my version of sprockets to 3.7.2
which has fixed the issue.