Skip to content

If build command fails raise a helpful exception #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 28, 2021

Conversation

phawk
Copy link
Contributor

@phawk phawk commented Sep 27, 2021

Fixes #28

I’m not sure convention wise if there are better ways of outputting this error message, let me know and I can make adjustments.

Once sorted I’ll PR a similar change into jsbundling-rails.

@dhh
Copy link
Member

dhh commented Sep 28, 2021

Does this swallow the original error? Or that'll just get shown as part of standard out? What does the console output look like in its entirety?

@phawk
Copy link
Contributor Author

phawk commented Sep 28, 2021

Nope it doesn’t swallow the yarn output, system returns false if the exit code was > 0.

Output when pushing to heroku without the node.js buildpack:

remote:        Bundle complete! 27 Gemfile dependencies, 84 gems now installed.
remote:        Gems in the groups 'development' and 'test' were not installed.
remote:        Bundled gems are installed into `./vendor/bundle`
remote:        Bundle completed (33.05s)
remote:        Cleaning up the bundler cache.
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        Yarn executable was not detected in the system.
remote:        Download Yarn at https://yarnpkg.com/en/docs/install
remote:        Yarn executable was not detected in the system.
remote:        Download Yarn at https://yarnpkg.com/en/docs/install
remote:        rake aborted!
remote:        cssbundling-rails: Command css:build failed, ensure yarn is installed and `yarn build:css` runs without errors
remote:        /tmp/build_54c5dff2/vendor/bundle/ruby/3.0.0/bundler/gems/cssbundling-rails-ae6760770765/lib/tasks/cssbundling/build.rake:5:in `block (2 levels) in <main>'
remote:        /tmp/build_54c5dff2/vendor/bundle/ruby/3.0.0/gems/sentry-ruby-core-4.7.3/lib/sentry/rake.rb:23:in `block in execute'
remote:        /tmp/build_54c5dff2/vendor/bundle/ruby/3.0.0/gems/sentry-ruby-core-4.7.3/lib/sentry/hub.rb:158:in `with_background_worker_disabled'
remote:        /tmp/build_54c5dff2/vendor/bundle/ruby/3.0.0/gems/sentry-ruby-core-4.7.3/lib/sentry/rake.rb:22:in `execute'
remote:        Tasks: TOP => assets:precompile => css:build
remote:        (See full trace by running task with --trace)
remote: 
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to anthem-test.
remote: 
To https://git.heroku.com/anthem-test.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/anthem-test.git'

@dhh dhh merged commit d920bc3 into rails:main Sep 28, 2021
@phawk phawk deleted the error_on_assets_precompile branch September 28, 2021 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hook into asset:pipeline silently fails on heroku
2 participants