ankane / pghero

A performance dashboard for Postgres

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uglifier::Error from production assets:precompile after 3.3.0 upgrade

danielmklein opened this issue · comments

Hi there! When we upgrade to pghero 3.3.0, we see an error that looks like the following from the rails assets:precompile step when building our Debian-based Docker image (Node version is 16.19.1 ).

I have also been able to reproduce the same error when running rails assets:precompile directly on my MacBook Pro (Node version 16.19.1) if I set RAILS_ENV=production.

In both cases, we run rails assets:clean beforehand.

Unfortunately, the Uglifier::Error doesn't actually come with an error message. I'm going to keep digging into this, but I wanted to go ahead and raise it here in case it was something obvious. Thanks for maintaining such a great library!

EDIT: it looks like switching to config.assets.js_compressor = :terser resolves this.

** Execute assets:precompile
rails aborted!
Uglifier::Error: 
/usr/local/bundle/gems/uglifier-4.2.0/lib/uglifier.rb:291:in `parse_result'
/usr/local/bundle/gems/uglifier-4.2.0/lib/uglifier.rb:221:in `run_uglifyjs'
/usr/local/bundle/gems/uglifier-4.2.0/lib/uglifier.rb:166:in `compile'
/usr/local/bundle/gems/sprockets-4.2.0/lib/sprockets/compressing.rb:84:in `block in js_compressor='
/usr/local/bundle/gems/sprockets-4.2.0/lib/sprockets/processor_utils.rb:84:in `call_processor'
/usr/local/bundle/gems/sprockets-4.2.0/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
/usr/local/bundle/gems/sprockets-4.2.0/lib/sprockets/processor_utils.rb:65:in `reverse_each'
/usr/local/bundle/gems/sprockets-4.2.0/lib/sprockets/processor_utils.rb:65:in `call_processors'
/usr/local/bundle/gems/sprockets-4.2.0/lib/sprockets/loader.rb:182:in `load_from_unloaded'
/usr/local/bundle/gems/sprockets-4.2.0/lib/sprockets/loader.rb:59:in `block in load'
/usr/local/bundle/gems/sprockets-4.2.0/lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
/usr/local/bundle/gems/sprockets-4.2.0/lib/sprockets/loader.rb:43:in `load'
/usr/local/bundle/gems/sprockets-4.2.0/lib/sprockets/cached_environment.rb:44:in `block in load'
/usr/local/bundle/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/map.rb:207:in `block in fetch_or_store'
/usr/local/bundle/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/map.rb:187:in `fetch'
/usr/local/bundle/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/map.rb:206:in `fetch_or_store'
/usr/local/bundle/gems/sprockets-4.2.0/lib/sprockets/cached_environment.rb:44:in `load'
/usr/local/bundle/gems/sprockets-4.2.0/lib/sprockets/base.rb:81:in `find_asset'
/usr/local/bundle/gems/sprockets-4.2.0/lib/sprockets/base.rb:88:in `find_all_linked_assets'
/usr/local/bundle/gems/sprockets-4.2.0/lib/sprockets/manifest.rb:125:in `each'
/usr/local/bundle/gems/sprockets-4.2.0/lib/sprockets/manifest.rb:125:in `to_a'
/usr/local/bundle/gems/sprockets-4.2.0/lib/sprockets/manifest.rb:125:in `block (2 levels) in find'
/usr/local/bundle/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:24:in `block in execute'
/usr/local/bundle/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:48:in `block in synchronize'
/usr/local/bundle/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:48:in `synchronize'
/usr/local/bundle/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:48:in `synchronize'
/usr/local/bundle/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:22:in `execute'
/usr/local/bundle/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/promise.rb:564:in `block in realize'
/usr/local/bundle/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:352:in `run_task'
/usr/local/bundle/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:343:in `block (3 levels) in create_worker'
/usr/local/bundle/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `loop'
/usr/local/bundle/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `block (2 levels) in create_worker'
/usr/local/bundle/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:333:in `catch'
/usr/local/bundle/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:333:in `block in create_worker'

Hey @danielmklein, thanks for reporting. Looks like it was a result of upgrading Highlight.js (b30aeb6), which uses ES6 syntax in version 10+. Converting to ES5 fixes it.